Laravel4 API Deployment Tutorial

apiplug_php_laravelAPI Plug allows you to create Laravel 4 API’s with a few click, now it is time to test it on your server.


Here is the tutorial for deploying your Laravel 4 API to your server.

Fast forward version

– copy files to web server
– adjust db credentials if needed
– enjoy


Once you generate an API file, follow these steps to be up and running.

– Copy Files to Your Web Server
– UnZip / UnTar Files
– Update Laravel & Vendor Packages
– (optional) Update Database Credentials
– Enjoy
– (optional) Apache .htaccess File

Let’s look at each step closely.

##Copy Files to Your Webserver
You can use scp, FileZilla or your transfer method of choice. Our NodeJS package have it’s own web server so you can copy it anywhere you want.

##UnZip / UnTar Files



`tar -zxvf yourfile.tar.gz`

#Update Laravel & Vendor Packages
We assume you have composer already installed in your system. Simply run
`sudo composer update` to make sure all dependencies are installed.

##(Optional) Update Database Credentials

We are big on data privacy, so if you opted to upload your schema, you need to go inside `/databases/` and update your credentials.

###MongoDB Authentication
MongoDB offsers various types of authentication mechanisms. We got you started with bare minimum. If you are using MongoDB 3.x you’d want to add
`’options’ => array(
‘db’ => ‘admin’ // sets the authentication database required by mongo 3
directive to your database config.

That was easy, right?

##(Optional) Apache .htaccess File
Depending on your server config, you may have a different htaccess file. We’re including this for convenience.

RewriteEngine On

# Redirect Trailing Slashes…
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller…
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *