Reputation: 1871
I'm developing a package in Laravel 5.5 where I need this package:
https://github.com/laracasts/PHP-Vars-To-Js-Transformer
The problem is that It's not registering for some reason. When I dd in the JavaScriptServiceProvider.php
nothing happens. When I use the Javascript
facade I get an error that it does not exists?!
My package composer.json file:
"require": {
"php" : "^7.0",
"illuminate/support": "~5.5.0",
"laracasts/utilities": "^3.0"
},
I use Laravel 5.5 so it should be registered by default (composer.json from laracasts package):
"extra": {
"laravel": {
"providers": [
"Laracasts\\Utilities\\JavaScript\\JavaScriptServiceProvider"
],
"aliases": {
"JavaScript": "Laracasts\\Utilities\\JavaScript\\JavaScriptFacade"
}
}
}
What am I doing wrong here?
Upvotes: 1
Views: 2101
Reputation: 19
You need to following steps, to solve this issue :
Run the command in your packages directory :
composer require laracasts/utilities
Now use this in your package (on top of the file) whenever you want to use this dependency:
use Laracasts\Utilities\JavaScript\yourClassName
Upvotes: 0
Reputation: 928
I faced the same problem using different other packages in my own package.
Here are the steps that worked for me:
Add the required package as a dependency in your own package:
composer require laracasts/utilities
Update your package in the Laravel project (e.g. by incrementing the version number or by removing your package and reinstalling it.
composer update # in main Laravel project
Let me know if this helped you or if I can give more assistance.
Upvotes: 6