LinkedIn Learning provides online training courses in a variety of subject matters. I’ve been honored to work with them on a few different courses at this point covering primarily PHP and related topics. The latest one went up earlier this week, it covers using Guzzle to communicate with RESTful APIs. APIs are a super popular tool in web development at practically all skill levels. You might start off just using something simple like the Google Maps API to put up a map on some sites and before you know it, you are building an API to be consumed by other software developers (or at least that was my path).
If you aren’t interested in working with Guzzle or RESTful APIs, take a look at the LinkedIn Learning site in general there are tons of courses on a wide variety of subjects.
You’ll be able to see any new courses I author at https://www.linkedin.com/learning/instructors/justin-yost.
Lynda.com is a website that provides online training courses in a variety of subject materials. I’ve been honored to work with them on a few different courses at this point covering both PHP and Ember.js. The latest one went up earlier this month, it covers some of the basics in working with PHPUnit, a unit testing framework and perhaps more importantly learning the Test-Driven Design pattern. TDD is one the biggest things you as a developer and software engineer can do to level up yourself as a developer. It takes you from a style of manual refreshing, testing and looking at things to figure out if something worked to instead validating your software and proving it works the way it’s intended. I’ve embedded below a video covering some of the reasons you should use and do unit testing.
If you aren’t interested in TDD or PHPUnit, take a look at Lynda just in general there is probably something of interest for you learn from. Lynda prides itself on producing quality content and it shows both in the courses and in working with them.
You’ll be able to see any new courses I author at lynda.com/justinyost.
I spoke on Building APIs, focusing mostly on the upfront design of APIs, at the most recent Las Vegas PHP Meetup. Overall this was defiantly one of my better talks with lots of good feedback. One key things helped I believe in the preparation and eventual presentation of the talk. I presented a rough version of this to my fellow Loadsys employees with some valuable feedback provided from them.
At this year’s CakeFest I gave a lighting talk titled “Projects Are Better When Maintained”. Essentially, it was a complaint to be a better maintainer of the open source stuff that you put out. It went over really well and I got some good feedback from it.
One of the key goals of CakePHP 3.0 as discussed recently was making CakePHP 3.0 more decoupled. CakePHP 3.0 has achieved that goal very nicely. Take a look at the CakePHP organization’s repos on GitHub and you will find a long list of decoupled collections of classes that are all part of the overall CakePHP framework that can be used completely independently of CakePHP itself.
Perhaps you are interested in some of CakePHP’s utility classes, like the Security utility, which are a great resource for hashing and encrypting basic data (not passwords) that you want some amount of reasonable security applied to it. Or perhaps you are interested in CakePHP’s Validation system which provides for validating arbitrary arrays of data. The most complex and most interesting part of CakePHP 3 by far is even available for use independent of the rest of the CakePHP core, the ORM layer.
How about an example to help clarify how to use these different pieces in smaller projects. Let’s build a simple webpage that allows us to submit a contact form request and validate it using the CakePHP Validation Library.
I’m doing this in a new `index.php` file in a new directory. First we need to get the Validation Library in our directory.
$ composer require cakephp/validation
That creates a new `composer.json` and loads the CakePHP Validation package. Next in our `index.php` file we need to load the Composer autoloader and the CakePHP Validation Class.
namespace LoadsysTestValidation; require dirname(__FILE__) . "/vendor/autoload.php"; use CakeValidationValidator;
Now at this point we can create a new instance of the Validator class and validate arbitrary arrays of data, like what we would get from `$_POST`.
$validator = new Validator(); $validator ->requirePresence('name') ->notEmpty('name', 'Name is required to be submitted.'); $errors = $validator->errors($_POST);
I worked out a complete example of this and posted it on GitHub as a sample if you need more details or insight into using the CakePHP packages.
The overall CakePHP framework may not be the right choice for everyone in every case. With the recent decoupling of the framework in the 3.0 branch, CakePHP can be more easily used for those times when you want to pick either the very best packages for your problem or you only need a limited subset of features from CakePHP for your web application.
This was previously posted on the Loadsys blog.
I gave this presentation last week at the Las Vegas PHP Meetup, covering some of the new features in CakePHP 3.0. It was a fairly short talk focused mostly on showing off code and some examples of what Cake 3.0 is looking like along with trying to answer some of the questions that I commonly hear inside of this group regarding CakePHP vs. every other framework. The sample project that I built is on Github.
As I give these presentations and watch other people give theirs, I am trying to reflect on them and figure out what works and what doesn’t. One thing that worked for the most part was not trying to write any code during the presentation, instead my idea was to flip through tags in the git repo between hey I did x and look what x did. This wasn’t actually a bad solution but not great. It had the flaw that because I had some changes along the way getting the repo actually working correctly, ignoring
tmp folders, etc, when I tried going to a tag and back I would up having to delete changes and basically reset the repo in the process. So partial credit there I think.
Think of this is a continuation of the topic from November (that one a PHP Classes 101), this one focused on the site http://www.phptherightway.com/ and other tools to help developers build PHP apps the “Right Way”. I also mentioned both The League of Extraordinary Packages as well as PHP-FIG.