Composer require/replace: package necromancy

Once in a while, I get lucky being asked to revive some legacy client project, that needs massive upgrades. Normally, the upgrade goes fine, meeting all required upgrades, making sure all the functionality is in place. But this time, the project was so outdated that the packages listed in composer dependencies didn’t just get into the archive. They were moved to a different repository, then closed down, and then mirrored by another developer....

April 14, 2020 · 1 min · anvyst

CakePHP Time formatting: year of "week of year"

While jumping between PHP and JavaScript - one of the most annoying things is dates handling. Recently, one of the clients reported that, while using our app for appointments and work schedule - they lost one of the working days. Client’s worker was supposed to work on the 31st of December 2019. Firstly, working on the 31st is an achievement. Since we can’t affect it, “bug report” was filled on our end....

December 7, 2018 · 1 min · anvyst

CakePHP CsvMigrations: prototype in 3 2 .. Done!

Every programmer is tired of coding yet another login form. Yet another CRUD view module. So today I’ll show you an example where our laziness can get you building prototype systems without a single line of extra code. One of the tasks, that we had to face when developing Qobrix CRM, was fast prototyping of the system. The result of ultimate laziness and DRY concept resulted in cakephp-csv-migrations plugin that we try to use pretty much everywhere, while delivering the system....

February 2, 2018 · 4 min · anvyst

CakePHP with NightwatchJS on Travis CI

After the release of Headless Chrome browser (v59+) most of the automation tools slowly started reducing the usage of Selenium, by replacing it with the combination of chromedriver + chrome/chromium pre-installed browser (like Travis CI does on their images). As a replacement, I’ve tried playing around with the combination of Karma/Chai to test JavaScript functionality of certain projects we have in Qobo. It only introduced the unit test approach towards the code base....

August 31, 2017 · 3 min · anvyst

CakePHP: Interview with Larry E. Masters

Interesting interview with one of the core members of CakePHP community - Larry E. Masters. Throughout the interview Larry covers CakePHP Framework history, as well as covering major milestones of CakePHP 3.x version. If you’re still into 2.x then it’s time to upgrade, as it brings some nice perks. More flexible code, and massive performance boost.

May 29, 2017 · 1 min · anvyst

PHP: Testing protected methods in CakePHP3

One of the things I recently had to deal with - PHP unit testing protected methods of the class in CakePHP 3. Few seconds of checking StackOverflow brought a nice and elegant way of checking protected methods using ReflectionClasses. Sebastian Bergmann has a complete guide how to check non-public functionality of the classes in his archieves. Here’s a short sample of the code using CakePHP3: <?php use Search\Model\Table\SaveSearchTable; use Cake\TestSuite\TestCase; class SaveSearchTableTest extends TestCase { public function setUp() { $this->SavedSearches = \Cake\ORM\TableRegistry::get('SavedSearches'); } public function testProtectedMethod() { $methodName = 'protectedMethod'; $reflectionClass = new \ReflectionClass('\Search\Model\Table\SaveSearchesTable'); $method = $reflectionClass->getMethod($methodName); $methodResult = $method->invokeArgs( $this->SavedSearches, ['arg1', ['arg2']]); $this->assertNotEmpty($methodResult); } }

February 7, 2017 · 1 min · anvyst

PSR-7: storage-less sessions

The new session system was implemented by @srgmrzv using PSR-7 storage-less sessions: https://t.co/W6q2lm1Ryj https://t.co/fZFTrPuy3q — Matthieu Napoli (@matthieunapoli) January 26, 2017

January 27, 2017 · 1 min · anvyst

CakeDC upgrade adds Google Authenticator

Few days of work, and almost a month of waiting. It was totally worth it. Yesterday noon, CakeDC community upgraded one of its major plugins with our Qobo patch. It allows users to enable Google Authenticator. There’s no need anymore to use ‘dev-develop’ branches in composer.

December 20, 2016 · 1 min · anvyst

Google Authenticator in CakePHP3.x

Google Authenticator gets a new wave of interest from the web community, trying to put an extra layer on top of user authentication process. There’s a plethora of plugins and components that let you authenticate with Google, but most of them aim to OAuth and Google+ integration. Two-step auth gets aside. I took few hours on research for the simple 2FA library available on the net and found TwoFactorAuth that already support Google URI QR-codes, that can be easily embedded into any framework/application running on PHP....

November 25, 2016 · 2 min · anvyst

Qobo: first month benchmark

It’s been already one month since I moved to Qobo Ltd, as a backend developer, so it’s about time to do some benchmarks on the work done. Open-Source The level of open source involvement of Qobo is enormous. All the projects I’ve been involved in before were always about open-source: it was either based on open-source, or using open-source solutions into some extend. Every time it ends up locking down the solutions for indoor use....

November 15, 2016 · 2 min · anvyst