Easiest way to write library in Laravel

Sometimes you have change a lot in your Laravel configuration and folder. This will avoiding running composer again.

First, just open your /app/start/global.php. Add a folder libraries (whatever you want):

app_path().'/commands',
app_path().'/controllers',
app_path().'/models',
app_path().'/database/seeds',
app_path().'/libraries',

And now you can add any file in your libraries folder.

Example:

<?php

/* File: Bantu.php */

class Bantu {

    public static function write( $message ) {

        echo $message;

    }

}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s