Laravel – How To Fix Wrong Domain in Queue Jobs

There is a tricky problem that happens when queued job tries to get the URL (via URL helper or from config) – it doesn’t seem to “notice” the .env / config app.url setting.

The reason is that somehow the queue worker misses the current environment name (might only happen if it is managed system wide via upstart or similar service).

The solution would be to include the –env flag when running queue worker like that: Continue reading

Laravel Goodies

Here’s the list of packages that make Laravel development even easier.

Development

PHPUnit – require-dev or require in composer.json

"phpunit/phpunit": "~4.0" 

and then run tests in cli directly from installed binary:

vendor/bin/phpunit

PHPSpec – require-dev or require in composer.json

"phpspec/phpspec": "~2.1" 

and then similar to PHPUnit, run the tests using binary in vendor/bin

vendor/bin/phpspec desc App/Test

Profiling / debugginglaravel-debugbar

IDE auto-completion / PHPDoclaravel-ide-helper

Faker – use to seed Database with realistic Data.
require-dev or require in composer.json

"fzaninotto/faker": "1.4.*@dev"

and then just get an instance

$faker = Faker\Factory::create(); 

and use it to fake just about anything.
Continue reading

How To Fix Laravel 4.0 – 4.1 Upgrade

Recently I’ve upgraded a Laravel 4 application from version 4.0.10 to 4.1.18. Despite Laravel’s website having a nice upgrade guide I did encounter few quirks that needed a little attention and some extra work.

So the very first thing to do, would be to follow the mentioned guide, hopefully you’ll end up with working new version of your application and wouldn’t need anything else (use “php artisan” command in your application folder to check out the current Laravel version).

Though I ended up with the following error each time I tried to run an artisan command (including simple “php artisan”):

PHP Fatal error: Class 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider' not found ...

And there were indeed no ConsoleSupportServiceProvider in my installation. Surely “composer.phar update” did not work as well as it tries to execute “php artisan …” commands and suggested “composer.phar update –no-scripts” worked, but didn’t fix anything.

After a bit of research I ended up with a kind of “clean install” solution, so if you have the same or similar issue you may try following: Continue reading