Installation

#Requirements

As with Laravel we need the following extensions installed:

  • PHP >= 5.4
  • Mcrypt PHP Extension
  • OpenSSL PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension

We also require:

  • Laravel supported relational database. (MySQL, Postgres, SQLite, or SQL Server)
  • ImageMagick

To install ImageMagick on Ubuntu / Homestead use the following commands:

sudo apt-get install imagemagick
sudo apt-get install php5-imagick

#Installing through the browser

Installing Devise via browser is simple and painless. After grabbing the latest version of Devise and then properly adding its resources to your project, simply open a browser and navigate to your project's url. Your browser will be redirected to the installer's welcome page.

Watch out

If you are having issues with your application's url resolving and/or being redirected to the installation welcome screen, you most likely have an issue in your "homestead.yaml" or "/etc/hosts". Review the steps listed under the #environmental configuration section.

Complete the form on each step to configure your environment, database, application settings and admin user credentials. Then let Devise take care of connecting the dots and getting the application up-and-running.

#Installing Through The Command Line

Installation through the command line is as simple as:

1. Add Devise to your composer


"require": {
    "laravel/framework": "5.*",
    "devisephp/cms": "*",
    "illuminate/html": "5.*"
}

/composer.json

2. Composer Update from command line


composer update

3. Add Devise service provider and facades


...
'Illuminate\Validation\ValidationServiceProvider',
'Illuminate\View\ViewServiceProvider',

/*
 * Devise Service Provider
 */
'Devise\DeviseServiceProvider',

/*
 * Application Service Providers...
 */
'App\Providers\AppServiceProvider',
...

/config/app.php

Watch Out!

Make sure the deviseServiceProvider appears above the Application Service Providers


/*
 * Devise Facades...
 */
'Sort'            => 'Devise\Support\Sortable\SortableFacade',
'DeviseUser'      => 'Devise\Users\DeviseUser',
'RuleManager'     => 'Devise\Users\Permissions\RuleManagerFacade',
'Form'            => 'Illuminate\Html\FormFacade',
'HTML'            => 'Illuminate\Html\HtmlFacade',

/config/app.php

Quick Tip

If you run the installer and opt not to run application migrations be aware that if you run them after the install you will get a "Users table already exists" error. To remedy delete the following two files: /database/migrations/2014_10_12_000000_create_users_table.php /database/migrations/2014_10_12_100000_create_password_resets_table.php

4. Run the installer

php artisan devise:install

Currently, this command simply runs these commands in the following order

php artisan devise:migrate
php artisan devise:assets
php artisan devise:seed

#Installing Devise On An Existing Project

If you are installing Devise "by hand" on an existing Laravel 5 project take the following steps.

1. Add Devise to your composer


"require": {
    "laravel/framework": "5.*",
    "devisephp/cms": "*",
    "illuminate/html": "5.*"
}

/composer.json

2. Composer Update from command line


composer update

3. Add Devise service provider and facades


...
'Illuminate\Validation\ValidationServiceProvider',
'Illuminate\View\ViewServiceProvider',

/*
 * Devise Service Provider
 */
'Devise\DeviseServiceProvider',

/*
 * Application Service Providers...
 */
'App\Providers\AppServiceProvider',
...

/config/app.php

Watch Out!

Make sure the deviseServiceProvider appears above the Application Service Providers


/*
 * Devise Facades...
 */
'Sort'            => 'Devise\Support\Sortable\SortableFacade',
'DeviseUser'      => 'Devise\Users\DeviseUser',
'RuleManager'     => 'Devise\Users\Permissions\RuleManagerFacade',
'Form'            => 'Illuminate\Html\FormFacade',
'HTML'            => 'Illuminate\Html\HtmlFacade',

/config/app.php

Quick Tip

If you run the installer and opt not to run application migrations be aware that if you run them after the install you will get a "Users table already exists" error. To remedy delete the following two files: /database/migrations/2014_10_12_000000_create_users_table.php /database/migrations/2014_10_12_100000_create_password_resets_table.php

#Environmental Configuration

Below we will cover setting up Devise, Laravel and Homestead in an OSX environment. For more information on setting up Homestead please refer to the Laravel documentation or for Windows check out this video on Treehouse.

1. Add entry to /etc/hosts like a-so:

127.0.0.1 devise-example.com

2. Add your site to your Homestead.yaml

In your Homestead.yaml file (the main configuration file for Homestead) add an entry for devise-example.com and map it to the application's public directory. It should look similiar to this:

- map: devise-example.com
  to: /home/vagrant/Code/devise-example/public

Watch out

Currently, in Homestead if you map the site incorrectly in the to: filepath that URL (devise-example.com) will need to be changed manually in the Nginx config file. Simply, changing it in the homestead config and reprovisioning doesn't seem to work. You can find this file by SSH'ing into your vagrant box and editing the file for your site entry. It is located (in this example) here: /etc/nginx/sites-enabled/devise-example.com. Just edit the root parameter's file path towards the top of the file. It should look something like this to get to it:

2b. Only do the following if you have the problem listed above otherwise move to step 3.

SSH into your vagrant box

homestead ssh

Edit your configuration file (replace devise-example.com with whatever domain you are working on.)

sudo vi /etc/nginx/sites-available/devise-example.com

Edit your root path (it should end with public)

root /vagrant/whatever/whatever/site/public

3. Provision the new site

cd into your Homestead directory (where homestead.yaml is located) and run "vagrant reload --provision". NOTE: If your vagrant box is not already up-and-running, you might need to run "vagrant up" rather than ".

All of the above steps can be found in more detail on the Laravel documetation page on Homestead

Devise Logo and Devisephp.com
Copyright © 2015 LBM

Devise content management system source code under MIT License
"Impediment to action advances action.
What stands in the way becomes the way"