Carlos Goce
Carlos Goce

Reputation: 1665

Using require-dev with composer and laravel

I was using require-dev for my development tools dependencies. Like the laravel debugbar, the barryvdh ide-helper, etc...

When i get to my production server and run "composer update --no-dev --no-scripts" everything seems to be OK.

Then, you realize that you must remove your "dev providers" from the app.php array.

So whats the point of using require-dev? there isnt a "providers-dev" array?

UPDATE: I was that i get it fixed but it's not working. I create the file app/config/local/app.php with this:

<?php
return array(
    'providers' => append_config(array(
        'Barryvdh\Debugbar\ServiceProvider',
        'Way\Generators\GeneratorsServiceProvider',
        'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider',
        'Barryvdh\Debugbar\ServiceProvider',
    ))
);

and on the top of app/start/global.php

$env = $app->detectEnvironment(function(){
    $hosts = array(
        'localhost' => 'local',
        '127.0.0.1' => 'local',
    );

    if(isset($hosts[$_SERVER['SERVER_NAME']])){
        return $hosts[$_SERVER['SERVER_NAME']];
    }

});

I tried echoing the $env variable and it returns 'local' so it's working. When i open my site i can't see the debugbar but everything else is working.

Any tip?

Upvotes: 3

Views: 1779

Answers (1)

Holger Weis
Holger Weis

Reputation: 1695

Just add your dev providers to app/config/local/app.php and use append_config:

'providers' => append_config(array(
    'Barryvdh\Debugbar\ServiceProvider',
))

Upvotes: 7

Related Questions