I need to create a module for my project that uses multiple composer packages which I don't want to add to my master Laravel project. So I need to publish config files for each one of these composer packages in my module and not in my master project and I don't know what to do to achieve this by the information you have provided in your package information.
Here is a my module config file using "willvincent/feeds" package :
'name' => 'Rss',
'scan' => [
'enabled' => true
],
'providers' => [
willvincent\Feeds\FeedsServiceProvider::class,
],
'aliases' => [
'Feeds' => willvincent\Feeds\Facades\FeedsFacade::class,
],
and what I wanted to do is running this command : php artisan vendor:publish --provider="willvincent\Feeds\FeedsServiceProvider" but nothing happens. I think this is because of these two lines :
'providers' => [
willvincent\Feeds\FeedsServiceProvider::class,
],
'aliases' => [
'Feeds' => willvincent\Feeds\Facades\FeedsFacade::class,
],
I will be glad if you help me fix this problem.
Best Regards
Hello, you need to add your package to the global composer file or it won't be required.
Hello,
By enabling the scan in module config file it will be automatically integrated in my global composer file but I want to know why I can't have independent composer packages inside my module or how it's achieved.
The scan option is not related to dependencies of your module.
It works like this because of composer.
This might give you more information: https://github.com/AsgardCms/Platform/wiki/custom-module-dependency
I get that but I need to know where to add 'providers' and 'aliases' inside our module independent of config/app.php file because it's related to our module only.
That needs to be added in the module.json file.
If you module.json isn't loaded means the package couldn't find it.
That fixed my problem !
For other people who might be interested here how my module.json file looks like :
"name": "Rss",
"alias": "rss",
"description": "",
"keywords": [],
"active": 1,
"order": 0,
"providers": [
"Modules\\Rss\\Providers\\RssServiceProvider",
"willvincent\\Feeds\\FeedsServiceProvider"
],
"aliases": {
"Feeds": "willvincent\\Feeds\\Facades\\FeedsFacade"
},
"files": [
"start.php"
]
also you might need to run composer update in order to make everything fine 馃槃
Awesome 馃憤
Most helpful comment
That needs to be added in the module.json file.
If you module.json isn't loaded means the package couldn't find it.