Laravel
A gem that helps in easy installation of new applications based on Laravel framework for PHP.
- Create a new Laravel application
- using source from official repository
- using source from your own fork of Laravel
- Caches the downloaded source for faster installations, in future.
- Configure the application, as neeed (e.g. turn on the profiler, set application index to empty)
- Updates permissions on the storage directory
So, effectively, I can give a command like:
laravel new my_app --config=index:'',key,ssl:enabled --source=http://github.com/laravel/pastes
to create a new Laravel application which:
- uses http://github.com/laravel/pastes as source
- updates permissions on the storage/ directory
- sets the application index to blank
- generates a random new application key
- enables the 'ssl' support in application/config/application.php
- makes future installs from this repository faster by caching this source
Currently, it is capable of creating new Laravel application based on the official source, or a fork and can even use source from a local directory. Further, it can configure the application, as required.
Installation
Add this line to your application's Gemfile:
gem 'laravel'
And then execute:
$ bundle
Or install it yourself as:
$ gem install laravel
Usage
Create a new Laravel application
Laravel gem has a caching mechanism in-built, which allows to keep a local copy when you use a repository for the first time. After this, whenever you use that repository again, it will only update the local copy of the repository (as opposed to a fresh git clone, which is considerably slow for certain connections). This will, allow you to install Laravel applications even when you are not connected to the Internet.
Since, you can specify which git repository to use to fetch the Laravel source, you can create new Laravel application based on your own or someone else's fork of Laravel, if required. And, yes! These repositories will be cached!
# use default settings (fetches source from http://github.com/laravel/laravel.git)
laravel new my_app
laravel new my_app --[no-]force # force overwrite
laravel new my_app --[no-]perms # (default) make "storage" directory world-writable
# use a specified repository
laravel new my_app --sourec=./src/laravel # relative directory
laravel new my_app --source=/usr/src/local # absolute directory
laravel new my_app --source="http://github.com/user/my_laravel_fork # a git repository
Create a customized Laravel application
When creating a new Laravel application, we can define configuration settings
using the '--config' flag. We can pass a comma-separated list of
setting:value
pairs, like the following. Note that, you can generate a new
application key by, simply, passing key
instead of key:some_fixed_key
.
# generate a new key, set index to empty and turn on the profiler
laravel new my_app --config=key,index:'',profiler:on
# use a key, set index to "home.php", and update application's language to 'hi'
laravel new my_app --config=key:fixed_string,index:home.php,language:hi
# the settings I use:
laravel new my_app --config=key,index:''
## this creates a Laravel application from the official repository,
## sets the Application Index to blank, makes the storage directory
## world-writable, generates a new key for the application.
## Furthermore, this creates the local cache for the official repository
## which makes the future installs quite faster :)
In an existing Laravel application
# update Application Index for the application
laravel config update index '' # removes application index for app in current directory
laravel config update index 'home.php' --app=./new_app # update for app in specified directory
# generate a new key for the application
laravel config update key # generates key for app in current directory
laravel config update key 'fixed_string' --app=./new_app # set a key for app in specified directory
Help
laravel help
Coming Soon..
# create and customize a new Laravel application
<del>laravel new my_app --config:index='' # set application index to blank</del>
<del>laravel new my_app --config:key # generate a new key</del>
laravel new my_app --[no-]generator # download the Laravel Generator by Jeffrey Way
laravel new my_app --database=db_my_app # create a database, defaults to app name
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Testing
Note that, the tests for this gem can be really slow, since we download repositories from github for properly testing the gem. Moreover, running the test suite will download the official Laravel repository in the local cache, thereby, speeding up creation of new applications.