Symfony by the piece

A folder of cron scripts, each one a .php file with hand-parsed $argv. That is what CLI looked like on our legacy Kohana application until last month. One line fixed it: composer require symfony/console Now each script is a small Command class with named options, --help for free, and exit codes that cron can actually check. The framework around it did not notice anything. Console does not care who serves your HTTP. ...

May 10, 2016 · 2 min · Murat Useinov

Composer in a legacy Kohana project

require APPPATH.'../vendor/autoload.php'; One line in bootstrap.php. This month it became the whole strategy for a project we decided to keep on Kohana. The framework is quiet, the project is alive. These two facts have to coexist somehow. The plan: nothing new gets written the Kohana way. New dependencies come through Composer, and Kohana’s autoloader and Composer’s autoloader live together fine. First candidate was the HTTP client. We talk to two external APIs, and the code around Request_Client_External was not pretty. Guzzle is better in every way. But Guzzle does not spread through the codebase. There is an interface: ...

January 22, 2015 · 2 min · Murat Useinov

Composer next to Kohana bootstrap

One line in bootstrap.php, above Kohana::init(): require DOCROOT.'vendor/autoload.php'; That is the whole integration. Kohana keeps its modules and its underscore autoloader. Composer brings Packagist. Two autoloaders in one process, and they do not collide: Composer packages use namespaces, Kohana classes have underscores, the lookups never meet. { "require": { "guzzlehttp/guzzle": "~5.0" } } This setup runs in production on one of my projects for a few months. Zero problems from the autoloading side. The problems, when they came, were from me. ...

November 23, 2014 · 2 min · Murat Useinov