I have tried to develop a custom package but ended with errors
I have a package structure in my below as given below:
can any body tell me why the package route is not working or i have done some errors?If you can provide me the links for the development of the package in laravel 5.2 then i will be very appreciated.
Please i need help.
composer
service provider
Same issue on Laravel 5.3 custom package routes will not be working.
First make sure you have registered your service provider in "config/app.php" section "providers".
And second it MUST BE after the Laravel service providers, but before the App service providers.
For me on Laravel 5.3, it worked after I put it last in the 'providers' array of config/app.php
Related
So I am relatively new to Laravel so i'm trying to seek some advice. I've read the documentation on packages provided by laravel. Now i understand you need a service provider to connect your package to laravel like so: Blog\BlogServiceProvider::class. Now what i am trying to do is have a control panel that installs packages straight off of packagist. Now i can manipulate the composer.json file quite easily in code. However, what i am trying to work around is declaring the service provider. I think it would be inconvenient if i have a dynamic installation but you have to declare the service provider yourself. Is there a way i can dynamically register the service provider in Laravel 5?
You can dynamically add service providers through the App facade:
App::register('App\Providers\SomeServiceProvider');
I am using https://github.com/vladimir-yuldashev/laravel-queue-rabbitmq
After running composer install successfully and updating app.php it throws following error. I have made sure that configs are correct. I am using Laravel 5.1
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'VladimirYuldashev\LaravelQueueRabbitMQ\LaravelQueueRabbitMQServiceProvider' not found
Apparently there was some issue in the 5.1 tag itself. I raised on issue with creator. Here is the link to ticket https://github.com/vladimir-yuldashev/laravel-queue-rabbitmq/issues/46
After few days https://github.com/vladimir-yuldashev/ (the author) replied and I took the update. Issue was gone.
Thanks to package author. All credit goes to him.
After composer update is finished you need to add ServiceProvider to your providers array in app.php:
VladimirYuldashev\LaravelQueueRabbitMQ\LaravelQueueRabbitMQServiceProvider::class
(vladimir-yuldashev/laravel-queue-rabbitmq)
I've built a composer package for Laravel and it uses a Service Provider. I currently load it in the "providers" array in app.php after installing it to get it to work, but it seems like there should be a way to tell Composer to do that automatically to make set up easier for developers. Is that possible, or does it have to be done manually by the developer when they make a new package?
Yes, it's required that you register the Service Provider in the app config. Even if you find a way to autoload your Service Provider with Composer, it doesn't know what a Service Provider is. You need to register it within the framework, because Laravel will handle calling your boot() and register() methods in the right order at the right time.
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.
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.