Reputation: 105
I was wondering if it was possible to create a custom laravel "template" with composer.
For example, I want to include in my composer's create-project laravel/laravel install these two extensions by default,
https://github.com/briannesbitt/Carbon
https://github.com/maxhoffmann/parsedown-laravel
or additional folders in the root directory so I don't have to re-create them each time.
I don't mean to ask how to install those ^ above,
but I mean to ask how to set it up so that
when i run
composer create-project laravel/laravel projName
It automatically has those files/extensions/etc
created and/or installed
Upvotes: 1
Views: 902
Reputation: 185
Probably best thing to do is install default Laravel, configure as you wish then save your default template on github... that way you can just do git clone url_to_your_template_repository
?
Upvotes: 0
Reputation: 7294
If I'm understanding you correctly, you can load custom libraries and have them autoloaded via composers "autoload" section. How you actually load the code into you project is up to you. git submodules is a good option. I'm not familiar with the Laravel directory structure so replace the paths to something that fits:
{
"require": {
// requires go here
},
"require-dev": {
// require dev go here
},
"config": {
"bin-dir": "bin/"
},
"autoload": {
"psr-0" : {
"Carbon": "src/lib/Carbon/src",
"Carbon\\Test": "src/lib/Carbon/tests"
}
}
}
Upvotes: 0
Reputation: 146191
Just add maxhoffmann/parsedown-laravel
in your composer.json
file:
"require": {
"laravel/framework": "4.1.*", // version could be 4.2.*
"maxhoffmann/parsedown-laravel": "dev-master"
},
The Carbon
package is already avaiable with Laravel
by default. Also in app/config/app.php
add another entry in providers
array like this (Check details here):
'providers' => array(
// other entries...
'MaxHoffmann\Parsedown\ParsedownServiceProvider'
),
Also add an entry in aliases
array like this:
'aliases' => array(
// other entries...
'Markdown' => 'MaxHoffmann\Parsedown\ParsedownFacade',
),
You said:
or additional folders in the root directory so I don't have to re-create them each time.
It doesn't make any sense, sorry!.
Upvotes: 1