You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Laravel auto-discovery could be used to automatically run BusinessDay::enable('Illuminate\Support\Carbon'); then a file in config directory could be used to pass options. So Laravel users would not have to run global code on bootstrap.
A great solution would be to create a feature in Carbon first to read composer.json of other packages in the vendor directory, then retrieve the extra.carbon config from it that would indicates to Carbon the packages contains macros/mixins and how to enable and configure them. Then Carbon itself would enable them automatically on the Laravel boot it already has and could even call them in some custom boot method with any other framework.
A fallback solution would be to create class Cmixin\BusinessDay\BusinessDayServiceProvider extending Illuminate\Support\ServiceProvider with the enable() call inside the boot() method and a $this->mergeConfigFrom() inside the register().
The realization of this is not planned yet. So if someone is interested in making a pull-request for this, it would be a pleasure to help her/him to contribute for this.
Laravel auto-discovery could be used to automatically run
BusinessDay::enable('Illuminate\Support\Carbon');
then a file inconfig
directory could be used to pass options. So Laravel users would not have to run global code on bootstrap.A great solution would be to create a feature in Carbon first to read composer.json of other packages in the vendor directory, then retrieve the extra.carbon config from it that would indicates to Carbon the packages contains macros/mixins and how to enable and configure them. Then Carbon itself would enable them automatically on the Laravel boot it already has and could even call them in some custom boot method with any other framework.
A fallback solution would be to create
class Cmixin\BusinessDay\BusinessDayServiceProvider
extendingIlluminate\Support\ServiceProvider
with the enable() call inside the boot() method and a$this->mergeConfigFrom()
inside the register().Then adding the auto-discovery in composer.json
Good example here: https://github.com/aaroncadrian/carbon-macros/blob/master/src/CarbonServiceProvider.php
Note: Same feature would be added on https://github.com/kylekatarnls/business-time and we should check both can be configured with no conflict.
See kylekatarnls/business-time#10
The text was updated successfully, but these errors were encountered: