Another Laravel Installer

タグ: Laravel4  

Yes. Laravel installer is so simple. Anyone can use it.

But I wanted more. I needed more. So I made it. Now beta, but it enough for me on functionary.

All is on https://github.com/laravel-ja/craft. And you can get phar file from http://laravel4.qanxen.info/laravelja.phar.

You can change laravelja.phar to favored command name.

As installer

Basic usage is same as official version. To install :

laravelja new project-dir

Differences are :

  • To generate application key, execute key:generate Artisan command.
  • Read .laravel.install.conf.php file from your home directory, and set config/lang file. (Also you can set machine name to decide 'local' envirionment.)

.laravel.install.conf.php file

See a sample :

<?php

return array(
    // Simply set.
    'app/config/app.php' => array(
        'locale' => 'ja',
    ),
    // All 'user' and 'password' set to 'root'
    // (We knew we must not.. but everyone love this.:D)
    // Then replace only mysql => password to 'OhMySQL'.
    'app/config/database.php' => array(
        'default' => 'sqlite',
        'user' => 'root',
        'password' => 'root',
        'mysql.password' => 'OhMySQL',
    ),
    // Simple one.
    'app/config/workbench.php' => array(
        'name' => 'HiroKws',
        'email' => 'hirokws@gmail.com',
    ),
    // Can cange lang item also.
    // This sample only for ja lang file.
    'app/lang/ja/reminders.php' => array(
        'sent' => 'パスワードリセットメールを送信しました。確認して下さい',
    ),
    // This is one of trick to set your machine name.
    'bootstrap/start.php' => array(
        'local' => "array('".gethostname()."')"
    )

);

First level key is file name. Second lelvel key is config/lang key using comma separated syntax.

This functionally implemented by regexp replacement. So if you specify simple key item, replace all value matched. (As 'user' and 'password' above sample.) To specify more use comma separated syntax. (If use 'key1.key2', it first try to find 'key1'=>, then search 'key2' =>, then replace fallowing strings. So this doesn’t mean pure array structure, just only strings order.)

So this work for present config/lang files installed with Laravel4.1, but not for all kind of PHP setting files.

Options for new sub command

Install Japanese version

You may never use this...

laravelja new Install-path --lang ja
laravelja new Install-path-l ja

Set 757 permission with files on app/storage

laravelja --set-mode new Install-path
laravelja -s new Install-path

Remove comments and empty lines from config/language files, routes.php and fileters.php

laravelja --remove-comments new Install-path
laravelja -r new Install-path

Remove comments from PHP files without vendor directory, and remove all md file

laravelja -minify new Install-path
laravelja -m new Install-path

Specify zip file

laravelja new Install-path --from http://example.com/some.zip
laravelja new Install-path -f http://example.com/some.zip

So, useful for experienced users

laravelja -s -r new Install-path

set sub command

Some option can use exist project folder. Like :

Option -r -s -m can apllay to existed project folder

laravelja -s -r set Exist-Project
laravelja -m set Exist-Project

Setting definitions in .laravel.install.conf.php file will be applied. But never do key generation. You can use Artisan command.

Self update

This tool have self update functionary. I'll update sometime, not so many.

Self Update sub command

laravelja selfupdate

I don't see forum every day. Please post to GitHub. Maybe someone want to correct my bad English. :D

ML Hiro