31 Mar

LinkedIn Learning Course – Consuming RESTful APIs in PHP with Guzzle

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.

23 Nov

Lynda Course – Test-Driven Development in PHP with PHPUnit

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.

07 Jul

Meetup Talk on Building APIs

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.

16 Apr

CakePHP 3.0, Use It In Pieces

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.

07 May

Line Clampin’ | CSS-Tricks

You want X lines of text. Anything after that, gracefully cut off. That’s “line clamping” and it is a perfectly legit desire. When you can count on text being a certain number of lines, you can create stronger and more reliable grids from the elements that contain that text, as well as achieve some symmetric aesthetic harmony.

There are a couple of ways to get it done, none of them spectacular.

If you are doing Web Design/Development as a full-time and aren’t reading CSS-Tricks, you really should be. Awesome little tricks like this one..

30 Apr

Hex Color Tool

I needed a tool that either added white or black to a hex color. Launching Photoshop just to drag a color picker around wasn’t cutting it. I looked around for a web app that would do this but unfortunately most good programmers are terrible designers. I built HexColorTool to fill the gap. It’s responsive too! Launch it on your smartphone or tablet and use it as you please.

Just added it to my list of web design tools, I know I’ve needed something like it more than once.

30 Apr

How To Make Your Open Source Project Really Awesome

If you plan on releasing a library as open source, please make sure it has

  • Clear dependency/installation instructions
  • At least one brief documentation guide
  • A change log and tags in the repo
  • Some information about supported language/runtime/tool versions and project maturity
  • A mailing list where users can ask questions and help each other

Doing anything less than this will cause some of your users grief and anger. And likely some wasted time.

Nice suggestions on improving open source projects and making them actually useful to more people than just yourself.

30 Apr

Users’ Pagination Preferences and ‘View All’

When providing a choice of display options, the computer should almost always respect the user’s stated preference and employ it as the default the next time around. I am amazed at how many sites and applications don’t do this and instead force users to repeat their choices again and again.

In short do pagination but if you offer different options remember what the user selected and use it throughout the site.

24 Jul

App Cubby Blog – The Sparrow Problem

Given the incredible progress and innovation we’ve seen in mobile apps over the past few years, I’m not sure we’re any worse off at a macro-economic level, but things have definitely changed and Sparrow is the proverbial canary in the coal mine. The age of selling software to users at a fixed, one-time price is coming to an end. It’s just not sustainable at the absurdly low price points users have come to expect. Sure, independent developers may scrap it out one app at a time, and some may even do quite well and be the exception to the rule, but I don’t think Sparrow would have sold-out if the team — and their investors — believed they could build a substantially profitable company on their own. The gold rush is well and truly over.

via App Cubby Blog – The Sparrow Problem. There is a real problem going to occur with regards to the App Store and desktop/mobile software in general if pure software businesses aren’t able to sustain themselves in the long-term. Apple can get away selling software for cheap thanks to hardware profits, what is the option for software only firms?

21 Feb

Mailinator(tm) Blog – How Mailinator compresses email by 90%

Given the title of this article, the first thing that should pop into your mind is probably – “well, use a compression algorithm – right?”.

Right! Well, yes, well, not exactly. Read on.

via Mailinator(tm) Blog – How Mailinator compresses email by 90%. A fun journey through algorithms to find a solution to getting some awesome compression stats.