Skip to content

michaellouieloria/laravel-starter

Repository files navigation

#BicolIT.org

##Requirements

PHP >= 5.4.0 (Entrust requires 5.4, this is an increase over Laravel's 5.3.7 requirement)
MCrypt PHP Extension

##How to install

Step 1: Get the code

Option 1: Git Clone

git clone git@github.com:bicolIT/bicolit.org.git

Option 2: Download the repository

https://github.com/bicolIT/bicolit.org/archive/master.zip

Step 2: Use Composer to install dependencies

Option 1: Composer is not installed globally

cd laravel
curl -s http://getcomposer.org/installer | php
php composer.phar install --dev

Option 2: Composer is installed globally

cd laravel
composer install --dev

Step 3: Configure Environments

Laravel 4 will load configuration files depending on your environment. Basset will also build collections depending on this environment setting.

Open bootstrap/start.php and edit the following lines to match your settings. You want to be using your machine name in Windows and your hostname in OS X and Linux (type hostname in terminal). Using the machine name will allow the php artisan command to use the right configuration files as well.

$env = $app->detectEnvironment(array(

    'local' => array('your-local-machine-name'), #hostname command
    'staging' => array('your-staging-machine-name'),
    'production' => array('your-production-machine-name'),

));

Now create the folder inside app/config that corresponds to the environment the code is deployed in. This will most likely be local when you first start a project.

You will now be copying the initial configuration file inside this folder before editing it. Let's start with app/config/app.php. So app/config/local/app.php will probably look something like this, as the rest of the configuration can be left to their defaults from the initial config file:

<?php

return array(

    'url' => 'http://myproject.local',

    'timezone' => 'UTC',

    'key' => 'YourSecretKey!!!',

    'providers' => array(
    
    [... Removed ...]
    
    /* Uncomment for use in development */
//     'Way\Generators\GeneratorsServiceProvider', // Generators
//     'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider', // IDE Helpers

    ),

);

Step 4: Configure Database

Now that you have the environment configured, you need to create a database configuration for it. Copy the file app/config/database.php in app/config/local and edit it to match your local database settings. You can remove all the parts that you have not changed as this configuration file will be loaded over the initial one.

Step 5: Configure Mailer

In the same fashion, copy the app/config/mail.php configuration file in app/config/local/mail.php. Now set the address and name from the from array in config/mail.php. Those will be used to send account confirmation and password reset emails to the users. If you don't set that registration will fail because it cannot send the confirmation email.

Step 6: Populate Database

Run these commands to create and populate Users table:

php artisan migrate
php artisan db:seed

Step 7: Set Encryption Key

In app/config/app.php

/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, long string, otherwise these encrypted values will not
| be safe. Make sure to change it before deploying any application!
|
*/
'key' => 'YourSecretKey!!!',

You can use artisan to do this

php artisan key:generate

Once you have generated your key, you might want to copy it over to your app/config/local/app.php local configuration file to have a different encryption key for each environment. A little tip, revert the key back to 'YourSecretKey!!!' in app/config/app.php once you are done copying it. Now it can be generated again when you move the project to another environment.

Step 8: Make sure app/storage is writable by your web server.

If permissions are set correctly:

chmod -R 775 app/storage

Should work, if not try

chmod -R 777 app/storage

Step 9: Build Assets

If you have setup your environments, basset will know you are in development and will build the assets automatically and will not apply certain filters such as minification or combination to keep the code readable. You will need to make the folder where the assets are built writable:

If permissions are set correctly:

chmod -R 775 public/assets/compiled

Should work, if not try

chmod -R 777 public/assets/compiled

To force a build of the dev collection use:

php artisan basset:build

The starter site uses two asset collections, public and admin. While in development, assets will be built in two folders, public and admin, inside of public/assets/compiled. These are ignored by git as you do not want them on your production server. Once you are ready to push or upload the code to production run:

php artisan basset:build -p public
php artisan basset:build -p admin

This will build the production assets in public/assets/compiled which will be versioned in git and should be uploaded to your production server.

Step 10: Start Page

User login with commenting permission

Navigate to your Laravel 4 website and login at /user/login:

username : user
password : user

Create a new user at /user/create

Admin login

Navigate to /admin

username: admin
password: admin

Application Structure

The structure of this starter site is the same as default Laravel 4 with one exception. This starter site adds a library folder. Which, houses application specific library files. The files within library could also be handled within a composer package, but is included here as an example.

Development

For ease of development you'll want to enable a couple useful packages. This requires editing the app/config/app.php file.

    'providers' => array(

        [...]

        /* Uncomment for use in development */
//        'Way\Generators\GeneratorsServiceProvider', // Generators
//        'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider', // IDE Helpers

    ),

Uncomment the Generators and IDE Helpers. Then you'll want to run a composer update with the dev flag.

php composer.phar update

This adds the generators and ide helpers. To make it build the ide helpers automatically you'll want to modify the post-update-cmd in composer.json

		"post-update-cmd": [
			"php artisan ide-helper:generate",
			"php artisan optimize"
		]

Production Launch

By default debugging is enabled. Before you go to production you should disable debugging in app/config/app.php

    /*
    |--------------------------------------------------------------------------
    | Application Debug Mode
    |--------------------------------------------------------------------------
    |
    | When your application is in debug mode, detailed error messages with
    | stack traces will be shown on every error that occurs within your
    | application. If disabled, a simple generic error page is shown.
    |
    */

    'debug' => false,

Troubleshooting

Styles are not displaying

You may need to recompile the assets for basset. This is easy to with one command.

php artisan basset:build

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published