Skip to content
Martin Mårtensson edited this page Feb 5, 2015 · 13 revisions

Composer

There are two ways to install this package with composer. A manual way or a command line way.

Laravel 4

If you want to use Basset with Laravel 4 you need to change @stable to 4.*@dev.

Command line

composer require marwelln/basset:@stable

Manual

Open up composer.json and add "marwelln/basset": "@stable" to your require block.

"require": {
    "marwelln/basset": "@stable"
}

After editing the composer.json file you need to update. To do so, run composer update. This is done automatically if you add the package using the command line.

Make it Laravel ready

Continuing on after adding the package and updating composer (composer update) you need to add the service provider.

Do so by opening up config/app.php (or app/config/app.php in Laravel 4), search for the providers array and add 'Basset\BassetServiceProvider'.

'providers' => array(
    ...
    'Basset\BassetServiceProvider'
    ...
)

If you want to add Basset collections with the Basset facade (not required) you need to update the alias array in app/config/app.php with 'Basset' => 'Basset\Facade'.

'aliases' => array(
    ...
   'Basset' => 'Basset\Facade'
    ...
)

Configuration file

If you opt out from using the Basset facade, publishing the config file is highly suggested. This is where you can have all your collections.

To publish it on Laravel 5, use:

php artisan vendor:publish

To publish it on Laravel 4, use:

php artisan config:publish marwelln/basset

Different public path

If you have changed your public path (to for example public_html) in Laravel 5, the publish command will fail as it can't find the path. To fix this, add a binding to app/Providers/AppServiceProvider.php inside the register method:

public function register()
{
	$this->app->bind('path.public', function() {
		return base_path().'/public_html';
	});
}