Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

Getting started with Laravel

Wednesday, January 21st, 2015 by Servage

le-laThe PHP framework Laravel has gained a lot of attraction in recent years and became one of the most popular frameworks available. It is fully compatible with your Servage web hosting account and is therefore one of the better options when choosing which platform you wish to build new projects on.

Laravel is very easy to learn, and quick to build code with. Therefore even existing projects could benefit from being moved over to Laravel, if they are not yet using an efficient framework.

Composer introduction

The Laravel installation is easily done with the Composer utility. Composer is a tool to manage packages and dependencies for PHP projects. Go to the Composer website and download the most recent composer.phar file. The utility is contained in that single file.

If you are not yet familiar with Composer it really pays of to spend some time learning about it. It provides a super nice way of installing other code needed for your project and keeping it up to date. You can also move your own open source projects into packages available for others to use via Composer. You can do so using Packagist.

Installing Laravel

This post assumes you work and develop your projects locally, and then upload the code to the server whenever an update is ready. For security and backup purposes it is recommended to always keep at least two copies of the code, hence local plus server is a good solution. If you want, you can even make it more efficient using source control.

Use the following Composer command to download Laravel:

composer global require "laravel/installer=~1.1"

Use the following Composer command to create a new Laravel project:

laravel new blog

The above approaches may vary depending on your operating system. See the Laravel installation page for more advanced options and information.

Configuring Laravel

All configuration options are residing in the app/config folder. Go there to manage the appropriate settings. For the beginning it should be sufficient to change the database configuration for the local/server database you wish to use. However, it is a good idea to browse all the configuration files because they provide great insight into the capabilities and options of Laravel.

Defining environments

One powerful feature of Laravel is to handle different environments. You can define a local development environment and the live production environment (or any other environments you need). The purpose of environment configuration is to make it easy to switch between different platforms, so you can easily develop locally with some settings, and then move the code to the server using some other settings.

Securely storing sensitive options

Some parameters of the configuration include sensitive information such as database username and password. That kind of information can be stored safely using special files as described here. This benefit removes any sensitive information from your source control.

Storage Permissions

You need to make the “storage” folder writeable by the Laravel application. This folder is used for various storage purposes like temporary files, sessions, cache etc.

Now you should be ready to go for your new Laravel project. Further topics on Laravel will be described in coming articles.

Getting started with Laravel, 3.6 out of 5 based on 7 ratings
Categories: Guides & Tutorials

Keywords: ,

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

No comments yet (leave a comment)

You are welcome to initiate a conversation about this blog entry.

Leave a comment

You must be logged in to post a comment.