1
votes

I have created a package for Laravel, the package is using its own composer.json for specifying requirements. The problem is how to make Laravel's composer to "include" the package's composer requirements? so that when I run composer update the package requirements installed along with the app requirements.

I used normal composer for package:

Path: app/packages/intropkg/composer.json

"require": { "spatie/emoji": "^1.0" },

but when calling the package from Laravel I get the error: Class 'Spatie\Emoji\Emoji' not found

Laravel composer related config:

Path: app/composer.json

"autoload": { ... "psr-4": { "App\\": "app/", "Lsdev\\Intropkg\\": "packages/intropkg/src" } }

1
Have you done composer dump-autoload? - Jite
did you run any composer command to get the dependencies? - lagbox
where did you add the require for that emoji package? - lagbox
If you modified your composer.json directly (ie you did not run composer require spatie/emoji) then you need to run composer install to install the new package. - Mathew Tinsley
I have already tried all that guys :( I'll add paths of composer files, I feel confusion here. please read the updated question. - wesamly

1 Answers

0
votes

Have you called composer update (not install!) after editing composer.json? Just running install will not pick up new dependencies