CakePHP Tips Summer 2019

0

This year I want to quickly put a few useful things out there again for you in terms of CakePHP development and ecosystem. CakePHP 4 preview Check out CakePHP 4 while it is still not RC (release candidate) and therefore…

CakePHP Tips 2017 Part 1

3

Whoops as ErrorHandler I recently switched to Whoops in my apps. It provides a better exception rendering for development mode for most cases. Just load the plugin (dereuromark/cakephp-whoops) and modify the bootstrap line: //(new ErrorHandler(Configure::consume(‘Error’)))->register(); (new \CakephpWhoops\Error\WhoopsHandler(Configure::consume(‘Error’)))->register(); If you already…

CakePHP Tips Winter 2016

2

This is literally my last blog post for the year 2016 🙂 Use the right DateTime typehint If you are passing DateTime objects around in CakePHP, they are usually Chronos objects, and either \Cake\I18n\Time or \Cake\I18n\FrozenTime then. Both those are…

CakePHP Tips Fall 2016

0

Always use proper version check method Be aware of version checks that are using the inferior and even wrong </> comparison. This can lead to wrong conditions with higher minor versions. I had this in my code from the early…

PHP

Use isset() and empty() wisely

0

This is another part of the series "How to write better PHP code". Sometimes it is the small things than can make all the difference. In this case simply using the correct way of checking for variable content can avoid…

CakePHP Tips 2015

0

Most tips are for 2.x and 3.x as they have been applied to both versions. Complex radio inputs A while back I posted a tip about deep array options for select input form fields. With my recent path for 2.6…

CakePHP Tips – Summer 2013

2

While CakePHP 2.4 is now just around the corner (already beta), a few tips gathered the last few days. Don’t mix controller and component pagination Currently, if you mix controller pagination setup and call the Pagination component then, it can…

CakePHP Tips

4

All new CakePHP tips collected over the last few weeks. Dispatcher execution order Tested on Cake2.3RC: APP/webroot/index.php CORE/bootstrap.php APP/Config/core.php APP/Config/bootstrap.php dispatchers defined in CORE bootstrap APP/Config/routes.php APP/Config/database.php controller and all the rest It is important to know that the dispatchers…

Some new crazy (Cake)PHP tricks

7

Crazy – because these tips are not used that often probably. But for some rare occasions they might come in handy. Inserting some rows into an array $array = array( ‘one’, ‘two’, ‘three’ ); $newValue = ‘one-point-five’; //with 0 as…