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

SitePoint PHP Blog:
Suggesting Carbon with Composer – Date and Time the Right Way
Nov 16, 2015 @ 09:16:58

On the SitePoint PHP blog there's a tutorial that's been posted spotlightling a PHP library that can make working with dates and times simpler: Carbon . In this new tutorial they walk you through what the library has to offer and plenty of examples of it in use.

Carbon is a small library for date and time manipulation in PHP. It relies on and extends the core DateTime class, adding helpful methods for a significantly saner experience.

In this article, we’ll take a look at some basic usage examples, and then use it in a real project.

They start with the installation (via Composer) and a few examples of it in use, determining if a given date string is a weekend, in a leap year, etc. They also talk about localization support and working with time intervals. He then gets into the more real-world part of the example, updating the Diffbot client to optionally support Carbon for its date/time handling. He starts with some tests to define how he wants the handling to work and how to use it to parse the date returned from the DiffBot API.

tagged: carbon datetime library tutorial date time diffbot client api

Link: http://www.sitepoint.com/suggesting-carbon-with-composer-date-and-time-the-right-way/

Dylan Bridgman:
Improving perceived load time
Aug 06, 2015 @ 09:43:34

On Medium.com Dylan Bridgman has posted a tutorial with a few tips helping you improve the perceived load time of your application, the time between when the page starts loading and the user can first do something with its contents.

In this article I will concentrate on perceived load time. That is the time from when a page starts loading until the user is able to proceed. There have been other articles on this topic, some of which go into far more detail in some areas. My intention is to give a summary on the latest information and what you should be doing in PHP. I will link to additional information where applicable.

He breaks the advice up into three main categories: output buffering, multiple connections and using correctly structured pages. Under each section there's a few sub-points with more information, details on implementation and links to other additional information. He also includes an example that combines all of the advice into one PHP/HTML script outputting some basic content.

tagged: perceived load time tutorial outputbuffer thread structure

Link: https://medium.com/@dylanbr/improving-perceived-load-time-a83aa32851b0

That Podcast:
Episode 21: The one with all the screen time
Aug 05, 2015 @ 13:47:25

That Podcast, hosted by Dave Marshall and Beau Simensen, has posted their latest episode today: Episode #21 - The one with all the screen time.

Beau and Dave change gears and get to some family talk, discussing managing kids with devices and screen time, football/soccer, dance and swimming activities, Beau announces his new position with Monii.com, then the guys get back in their comfort zone and talk briefly about continuous integration services, docker and CQRS.

Other topics and people mentioned in this episode include Symfony Live London, the Three Devs & A Maybe podcast, Jeff Carouth, Circle CI and many more. You can listen to this latest episode either through the in-page audio player or by downloading the mp3 directly. Also be sure to subscribe to their feed and follow them on Twitter if you enjoy the show.

tagged: thatpodcast ep21 screen time beausimensen davemarshall

Link: https://thatpodcast.io/episodes/episode-21-the-one-with-all-the-screen-time

Run Geek Radio:
Episode 005 – Time Estimation, Conference Talk Rating, Contest Winner
Jun 19, 2015 @ 11:02:38

The Run Geek Radio podcast has posted their latest episode today. In it (episode #5) host Adam Culp talks about time estimation, thoughts on conference talk ratings and the contest winner from his standing desk contest mentioned in an earlier episode.

This episode Adam Culp announces the winner, David Stockton (Colorado), of the contest launched in Run Geek Radio episode 004. [...] Adam also talks briefly to clarify his views on “soft talks” versus “soft skills talks”, and how he was misrepresented as disliking soft skills talks though the opposite is true. [...] Then this episode is rounded out with a detailed coverage of time estimation in relation to projects, and why it is so vitally important to be accurate. Adam also speaks about how important proper requirements gathering is to the process.

You can either use the in-page audio player to listen to this latest episode or you can download the mp3 of the show. Be sure to subscribe to the feed if you enjoy the show and want to hear more from Adam.

tagged: rungeekradio ep5 podcast time estimation conference talk rating contest winner

Link: https://rungeekradio.com/episode-005-time-estimation/

Build a Time Tracker with Laravel 5 and AngularJS – Part 2
Apr 22, 2015 @ 09:38:53

Scotch.io has posted the second part of their series today showing you how to build a simple time tracking application with Laravel and AngularJS. In this latest part of the series he finishes the application and connect the two pieces.

This is the second of a two-part series on using Laravel 5 and AngularJS together to build a simple time tracking application. If you’ve gone through part 1, you’ll have seen that we put together the front-end first and used a simple JSON file with some mocked-up data to test with. We left off with the ability to add new time entries and have the total time from all of them display on the side. We didn’t include any way to edit or delete the time entries, and of course there was no persistence to a database. In this part we will complete the application so that the time entries get stored in a database and our Angular front-end and Laravel backend work together to create, read, update and delete from it.

He starts by helping you get a Laravel application up and running (time-tracker-2), set up the database and modify the configuration to point to the database location. He helps you run the migrations to set up the database tables and generate the related model code. Next up he shows how to inject the seed data, setting up the main index view and adding in routes for the Angular code to access. The rest of the article is just about as detailed and covers steps to:

  • View all the Available Routes
  • Return all Time Entries
  • Return All Users
  • Updating the front-end
  • Setting up the users list
  • Creating time entries
  • Updating time entries
  • Deleting time entires

Finally he wraps it all up with a few possible things that could be done to improve the application, both simple and a bit more complex. He challenges you the developer to implement those features.

tagged: tutorial angularjs laravel series part2 time tracker application

Link: https://scotch.io/tutorials/build-a-time-tracker-with-laravel-5-and-angularjs-part-2

Build a Time Tracker with Laravel 5 and AngularJS – Part 1
Mar 27, 2015 @ 08:49:57

On the Scotch.io site there's a new tutorial showing you how to build a time tracking application with a combination of Laravel and AngularJS. This is the first part of a new series and focuses on the basic principles and getting some of the first parts of the application up and running.

Laravel and AngularJS work great together, but it can be a little tricky to get going at first, especially if you are new to the frameworks. In a previous article, Chris showed you how to make a Single Page Comment App with Laravel and Angular. This tutorial will again bring the two frameworks together as we build out a simple time tracking application.

We’ll be going into a lot of detail in this tutorial, so to make things manageable it has been broken into two parts. The first part will focus on getting the front-end setup with AngularJS and the second part on getting the backend setup with Laravel 5.

He starts with an overall look at the application and what functionality it will have. From there he walks you through:

  • Setting up the folder structure
  • Installing dependencies
  • Creating Javascript files
  • Setting up the view
  • Adding extra styling
  • Fetching the time data

He makes use of the Moment.js library to perform some of the time calculations for the difference and total time elapsed. He ends the post by tying up some loose ends with the controller and updating the view with the new calculated time values.

tagged: tutorial laravel angularjs time tracker application series part1

Link: https://scotch.io/tutorials/build-a-time-tracker-with-laravel-5-and-angularjs-part-1

That Podcast:
Episode 12: The one where we find the time to discuss not finding the time
Dec 12, 2014 @ 10:33:35

That Podcast, with PHP community member hosts Beau Simensen and Dave Marshall, has released their latest episode today: Episode #12, The one where we find the time to discuss not finding the time.

Beau and Dave take time out of there busy schedules to discuss what they've been up to recently and get in to the how they do or don't find the time for side projects and open source, in and around work and family.

There's lots of different topics touched on in this episode including:

You can listen to this latest episode either through the in page player or by downloading the mp3 for listening offline. If you enjoy the episode be sure to subscribe to their feed too!

tagged: thatpodcast ep12 time discussion beausimensen davemarshall

Link: http://thatpodcast.io/episodes/episode-12-the-one-where-we-find-the-time-to-discuss-not-finding-the-time/

Anthony Ferrara:
It's All About Time
Dec 01, 2014 @ 10:46:15

In his latest post Anthony Ferrara talks about a tricky subject in PHP - timing attacks. A timing attack has to do with vulnerabilities that can come up because of the differences in time it takes to perform cryptographic operations (like hashing or encrypting).

An interesting pull request has been opened against PHP to make bin2hex() constant time. This has lead to some interesting discussion on the mailing list (which even got me to reply :-X). There has been pretty good coverage over remote timing attacks in PHP, but they talk about string comparison. I'd like to talk about other types of timing attacks.

He starts with a definition of what a remote timing attack is and provides an example of a simple script showing the delay that's key to the attack. His script deals with string location but it gives you an idea of how the attack works and where the danger lies. He points out that even remotely attackers could determine the times to perform operations (down to the nanosecond) and use this to their advantage. He points out that both == and === are vulnerable to this type of attack because of how the comparison happens. He gives two options (one an internal function) to help protect your application and briefly covers a few other types of timing attacks: index lookup, cache-timing and branch-based timing attacks.

tagged: timing attack comparison time example tutorial introduction prevent

Link: http://blog.ircmaxell.com/2014/11/its-all-about-time.html

Sameer Borate:
Period: Time range API for php
Nov 05, 2014 @ 10:55:28

In his latest post Sameer Borate looks at a library he's recently found that's helpful for working with dates and times, even easier than the DateTime handling built into PHP. The Periodlibrary, part of The League of Extraordinary Packages, aims to "resolve many recurrent issues around time range selection and usage."

Date/time programming is one of the tricky aspects of software development. Although inherently not complex in itself, coding date/time algorithms can be a subtle source of bugs. Especially in web development a feature such as payment subscription processing that ranges from days to weeks to months can get complex quickly. Also such kind of scenarios require additional features like auto renewal, scheduled email alerts to subscribers etc. Such kind of features require good date/time handling algorithms and libraries that handle such chores are always welcome. One such library I encountered recently is Period.

He walks you through the basics first - getting the library installed and creating a new instance of the class to work with. He goes through each of the methods available including the constructor, getting the duration between times and getting the start/end values back as DateTime objects. He also looks at the methods that allow you to create the ranges from various time frames (quarters, weeks, etc), compare ranges and modify time ranges that already exist.

tagged: time range library period leagueofextraordinarypackages datetime

Link: http://www.codediesel.com/algorithms/period-time-range-api-for-php/

Mathias Verraes:
Named Constructors in PHP
Jun 13, 2014 @ 09:42:15

Mathias Verras has a new post to his site about an idea he calls "named constructors". This method uses static factory methods to simulate the idea of a constructor and initialize the object.

PHP allows only a single constructor per class. That’s rather annoying. We’ll probably never have proper constructor overloading in PHP, but we can at least enjoy some of the benefits. Let’s take a simple Time value object. Which is the best way of instantiating it? The only correct answer is “it depends”.

His example shows the typical constructor creation with variable arguments, but points out that this can get messy quickly. His other method, the factory methods as "constructors", can make for a cleaner interface and makes the class more flexible. They make the object able to be initialized with different types of values and even satisfies the Single Responsibility Principle. He goes through a few examples using his "Time" class, showing how different "constructor" methods can be used to handle inputs ranging from a normal hour/minute format out to a "from minutes since midnight" value.

tagged: named constructor factory method static tutorial time

Link: http://verraes.net/2014/06/named-constructors-in-php/