potsky / laravel-localization-helpers

🎌 Artisan commands to generate and update lang files automatically
GNU General Public License v3.0
187 stars 38 forks source link

laravel/framework as a dependency #49

Closed cdarken closed 7 years ago

cdarken commented 7 years ago

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.

potsky commented 7 years ago

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 ?

potsky commented 7 years ago

It seems to be a problem... Do you know a package which has the expected behaviour and which works with both Laravel and Lumen ?

cdarken commented 7 years ago

Looking into it.

cdarken commented 7 years ago

There are 2 options that I see right now:

  1. make a new service provider for Lumen (like https://github.com/nordsoftware/lumen-cors/blob/develop/src/CorsServiceProvider.php)
  2. 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.
cdarken commented 7 years ago

Hi and happy new year. Did you think about this? I've pushed a branch with the modifications for Lumen compatibility on my fork.

potsky commented 7 years ago

Hi !

Happy new year to you too!

Your commit is here : https://github.com/cdarken/laravel-localization-helpers/commit/0e7dbd5b36ac7289966556e7c65910b514233a44

Than I can check the used framework and performing a if / else on these items :

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 ?

cdarken commented 7 years ago

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');
potsky commented 7 years ago

Ok... So I will finally create a new branch especially for Lumen with the according documentation.