laravel/framework as a dependency
cdarken opened this issue · 8 comments
I'm using this package with Lumen. But because laravel/framework is specified as a dependency, it pulls the entire framework on composer install
. I was wondering, maybe you can you limit the dependencies to separate Illuminate packages.
Hello,
indeed, I use this dependency because of the way of Laravel (according to version) to boot service providers and declare facades.
Do you have an idea of the mutual composer dependency between Laravel and Lumen ?
lumen-framework
embeds theLaravel\Lumen\Application
classlaravel-framework
embeds theLaravel\Foundation\Application
class
It seems to be a problem... Do you know a package which has the expected behaviour and which works with both Laravel and Lumen ?
Looking into it.
There are 2 options that I see right now:
- make a new service provider for Lumen (like https://github.com/nordsoftware/lumen-cors/blob/develop/src/CorsServiceProvider.php)
- recommend the usage of the package https://github.com/irazasyed/larasupport that adds some helper functions that you use in the package
Both require minimal changes outside of the service provider, like usage of config() helper instead of Config::get which would require creating an alias for the Config facade in the bootstrap/app.php of the application using the package.
I can create a pull request for you to take a look if it's ok.
Hi and happy new year. Did you think about this? I've pushed a branch with the modifications for Lumen compatibility on my fork.
Hi !
Happy new year to you too!
Your commit is here : cdarken@0e7dbd5
- I can simply change the composer dependency and use yours given that the Laravel Framework has this dependency too with the same version logic.
- I can use the same
config
helper given that it exists in Laravel
Than I can check the used framework and performing a if
/ else
on these items :
Config::has
app('path')
I don't want to manage a new branch especially for Lumen ! I lose time with branches. When I add features, I code in master and then merge modifications manually on each branch...
I have added this in the bootstrap/app.php
file :
$app->register( Potsky\LaravelLocalizationHelpers\LaravelLocalizationHelpersServiceProvider::class );
But it seems there is no configuration file in Lumen... Just a question : how do you load my package in lumen and manage package configuration ?
For loading a config file you copy it manually in config/
and you use this call in bootstrap/app.php:
$app->configure('laravel-localization-helpers');
Ok... So I will finally create a new branch especially for Lumen with the according documentation.