Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Mohamed Said:
Laravel/MySQL JSON documents faster lookup using generated columns
Aug 22, 2017 @ 10:55:05

Mohamed Said has an interesting post to his site showing how to use computed columns for faster lookups in a MySQL database containing JSON documents.

Laravel 5.3 is shipped with built-in support for updating and querying JSON type database fields, the support currently fully covers MySQL 5.7 JSON type fields updates and lookups.

He includes an example of using the Eloquent DB handling to search for the data in the JSON and the results. He links to more information about the feature, following it up with an example of the main topic: computed columns. In it he shows how to create (on the SQL side) a generated/computed column that allows for easier extraction of the data directly from the JSON. This makes it even simpler to get the data just as you would in a normal select. He also includes an example of creating it via the Schema functionality in the database migrations.

tagged: mysql json column lookup computed generated sql data laravel tutorial

Link: https://themsaid.com/laravel-mysql-json-colum-fast-lookup-20160709

SitePoint PHP Blog:
Procedurally Generated Game Terrain with ReactJS, PHP, and Websockets
Apr 03, 2017 @ 13:41:45

Christopher Pitt has continued his series on the SitePoint PHP blog showing the creation of a game combining PHP & React JS. In this latest part of the series he builds on part one and hows how to procedurally generated game terrain.

Last time, I began telling you the story of how I wanted to make a game. I described how I set up the async PHP server, the Laravel Mix build chain, the ReactJS front-end, and the Web Sockets connecting all this together. Now, let me tell you about what happened when I starting building the game mechanics with this mix of ReactJS, PHP, and Websockets…

He started with the idea of a simple "farm" in the game represented by a set of "patches" in the game (pixels, basically). He includes the code he use to create it and allow for new ones to be created on request (including both the PHP side and the React.js code). He then shows how to modify it to make each farm requested come in with a bit of randomness as far as what kind of terrain (dirt/grass/wheat) it came in with. The post wraps up with the code required to render the farm in the UI and style it based on what kind of terrain it contained.

tagged: game terrain reactjs tutorial generated farm render procedural

Link: https://www.sitepoint.com/procedurally-generated-game-terrain-reactjs-php-websockets/

Ibuildings techPortal:
DPCRadio: The Cake is a Lie
Mar 15, 2011 @ 13:17:41

On the Ibuildings techPortal today they've posted the latest episode of their recording series from last year's Dutch PHP Conference (DPCRadio) - Sebastian Bergmann's talk The Cake is a Lie.

Scaffolding, the meta-programming method of building software applications, promises easier development and a faster time-to-market. But the "code generation bliss" can lead to problems later on, for instance with regard to maintainability and scalability. This sessions takes a skeptical look at frameworks such as CakePHP and symfony.

You can listen in one of three handy ways - either by listening in-page, downloading the (rather large) mp3 or by subscribing to their feed to get this and other great techPortal content.

tagged: dpc10 dpcradio podcast generated source sebastianbergmann cake lie

Link:

Zend Developer Zone:
Improved Test Assets for Zend_Tool Generated Projects in ZF 1.11.4
Mar 10, 2011 @ 11:10:52

On the Zend Developer Zone there's a recent post from Ralph Schindler talking about an update that's been made to the Zend Framework to improve generated testing stubs for Zend_Tool generated projects starting in ZF versions 1.111.4.

At the time of Zend_Tool's initial release, the standard application structure you are familiar with today was just being released as well with Zend_Application. In addition, the testing controllers from this newly standardized application layer, were too, in their infancy. [...] Recently, while Sebastian Bergmann was working on his pet project php-project-wizard, he noticed a few inconsistencies with the stubs that Zend_Tool was generating and decided to send us some recommendations on how to best leverage PHPUnit 3.4+ to test our application's assets.

He walks you through a newly generated project and shows (complete with screenshots) some of the updates that have been made like the new single bootstrap.php file, an updated phpunit.xml, a sample IndexController test and a bit of detail on what the generated tests actually look like.

tagged: test assets zendframework generated zendtool example

Link: