I am trying to install the Algolia laravel package but I am getting this error:
Trait 'App\AlgoliaEloquentTrait' not found
I follow the instructions under install, configuration and quickstart from this link:
https://github.com/algolia/algoliasearch-laravel#configuration
I simply added use AlgoliaEloquentTrait; to one of my models. What could I be doing wrong here?
You need to add
use AlgoliaSearch\Laravel\AlgoliaEloquentTrait;
at the beginning of your model.
Related
I tried adding Recaptcha through the Anhskohbo package but there is the error of no class found.
This package comes with laravel framework in my case I was upgrading the framework so I replaced the file app/config.php to new version
and it work
It tells you that it does not exist because it does not really exist. I think that if you download it, it will't work. You may have to take the full version of laravel framework as it is
or create new project for same version and tack app/config.php to your project
or reinstall by after delete vendor
composer install
I want to install this package in my project
https://github.com/spatie/laravel-sitemap
but the installation's failed. the error is
Anyone encountered this error. or their have other better package for laravel sitemap? any tutorial? thanks everyone :)
The error message is pretty clear. You're trying to install spatie/laravel-sitemap:^3.3, which requires laravel/framework:5.5 or higher. So you need to either upgrade to use Laravel 5.5, or use an older version of spatie/laravel-sitemap.
The Github repository lists the available releases. I would suggest looking at v2.4 as a starting point, as the ChangeLog for v3.0 mentions about adding Laravel 5.5 support.
composer require spatie/laravel-sitemap:2.4
Edit:
You asked where to put the generator code. It isn't something you're going to want to run on every request, so I would suggest creating a route dedicated to creating the sitemap.
// routes/web.php
Route::get('sitemap/generate', function () {
SitemapGenerator::create(base_url())->writeToFile($path);
});
Im currently trying to include illuminate/filesystem into lumen
So far I have managed to install the package running the following command:
composer require Illuminate/Filesystem
However I have no idea how to register the static class inside the application, I can't seem to find anything on the internet which talks about how to implement laravel 5 packages into lumen.
I have tried adding a class alias to the core of lumen, but this seems wrong to me.
There's nothing wrong with registering a class alias for the File facade, just don't do it in the framework source files (within the vendor directory). A good place to put that is inside the bootstrap/app.php file. Just add this and you're good to go:
class_alias('Illuminate\Support\Facades\File', 'File');
No additional packages need to be installed for this to work because Illuminate/Filesystem already comes with Lumen.
I want to use wepay PHP sdk in laravel 5 using composer but I didn't found any laravel package for it.
Can you please tell me me how can I do this?
The package is available via packagist.org - unfortunately only as a dev-master branch and with suboptimal autoloading configured (I'm trying to fix that, sent both a patch and opened an issue suggesting they tag their version).
Adding that package is basic Composer action. The classes should be automatically available within Laravel wherever you think you want to use it.
I'm trying to develop a custom package using "workbench". It's a simple package that will create a repository to consume a different API we have. I plan on injecting this repository into my controllers of my application. Anyway, I created the package using "workbench". This creates the service provider. The Laravel docs say to add the service provider to my "providers" array in app.config. I've done this, but when I run composer update, I get an error saying that the class is not found, specifically: PHP Fatal error: Class 'MyVendor\MyPackage\ServiceProvider not found in /.. .. .. ../laravel/vendor/framework/src/Illuminate/Foundation/ProviderRepository.php. I thought I followed the docs correctly, what am I missing?
Simply running composer install inside the workbench directory resolves this issue.