Ubuntu - Create a Laravel Project

Create folder for your project and navigate into it.

PROJECT_NAME="my-project"  
mkdir $PROJECT_NAME  
cd $PROJECT_NAME  

Install composer if you haven't already.

Initialize the project through composer.

composer create-project laravel/laravel . 4.2 --prefer-dist  

You should now have the Laravel framework in place. I would recommend taking a look at the composer.json file (below) and adding your own packages under require at this point.

{
        "name": "laravel/laravel",
        "description": "The Laravel Framework.",
        "keywords": ["framework", "laravel"],
        "license": "MIT",
        "require": {
                "laravel/framework": "4.2.*"
        },
        "autoload": {
                "classmap": [
                        "app/commands",
                        "app/controllers",
                        "app/models",
                        "app/database/migrations",
                        "app/database/seeds",
                        "app/tests/TestCase.php"
                ]
        },
        "scripts": {
                "post-install-cmd": [
                        "php artisan clear-compiled",
                        "php artisan optimize"
                ],
                "post-update-cmd": [
                        "php artisan clear-compiled",
                        "php artisan optimize"
                ],
                "post-create-project-cmd": [
                        "php artisan key:generate"
                ]
        },
        "config": {
                "preferred-install": "dist"
        },
        "minimum-stability": "stable"
}

Deployment

Now you just need to deploy your webserver, or you could use docker to take care of this for you as shown below:

git clone https://github.com/programster/dockerized-laravel.git
cd dockerized-laravel
composer update
cd docker
bash build.sh

Wait for it to finish building before running the container.

bash run-container.sh  

References

Laravel Docs - Installation

Author

Programster

Stuart is a software developer with a passion for Linux and open source projects.

comments powered by Disqus