A template for creating laravel packages
git clone git@github.com:ChrisBraybrooke/Laravel-Package-Template.git package-name
cd package-name
git remote set-url origin new-url.git
git push -u origin master
-
Open up
composer.json
and replace the name for the name of this package. You can also give it a description. -
Do a find and replace across the whole package (including the pre mentioned
composer.json
file) forNAMESPACE_HERE
which should be replaced with the package name in PascalCase. i.e AwesomePackage. -
Open the
ServiceProvider.php
file and replace the string returned byshortName
method with the name you put in thecomposer.json
. -
If you need a config file, you should also rename the
config/chrisbraybrooke-package.php
filename with the string returned byshortName
.
You will need a 'host' project, this could be a blank laravel install or another project.
cd host-project
vim composer.json
Then paste the following anywhere in the file.
"repositories": {
"chrisbraybrooke/package-name": {
"type": "path",
"url": "package-url-on-filesystem",
"options": {
"symlink": true
}
}
}
Finally install the package on the host project
composer require chrisbraybrooke/package-name