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

php[architect]:
Education Station: Simple, Compact Time Range Creation with Period
Jul 18, 2017 @ 15:08:48

php[architect] magazine has shared a column from their July 2017 issue, "Education Station" by Matthew Setter, looking at the use of Period for date and time handling.

For the longest time, I’ve enjoyed using PHP’s DateTime library. I’ve always found it to be relatively straightforward in creating DateTime objects for use with various applications I’ve written.

However, one thing that isn’t very simple, nor intuitive, is the ability to create time ranges—especially ones requiring some degree of sophistication, such as fiscal quarters, for financial reporting requirements. [...] It’s for [code reuse] reasons that I’m going to spend the [end] of the column introducing Period, a Time range API for PHP, maintained by The League of Extraordinary Packages.

He starts off by showing how to do things "the hard way" with the built-in PHP DateTime handling and how difficult it can be to work with ranges. In his example he tries to get the dates for a "quarter", a portion of a year usually used for business reporting purposes. He works through some of the issues he faced during the date calculations and things lie leap years and odd date ranges. He then introduces Period as a way to help solve some of these problems. He lists out the main goals of the project, installing the package and using it to get the same "quarter" dates as his attempt before.

tagged: educationstation column matthewsetter phparchitect july2017 issue period datetime

Link: https://www.phparch.com/2017/07/education-station-simple-compact-time-ranges/

php[architect]:
July 2017 Issue Released - Safe at Speed
Jul 12, 2017 @ 17:07:57

php[architect] magazine has posted their latest issue, the July 2017 edition of the magazine - Safe at Speed:

“Safe at Speed” includes articles on:
  • Setting up infrastructure from Zero to Cloud in One Hour With the Google Cloud by Robert Aboukhalil.
  • Geogriana Gligor writes on Smart, Scalable Content Distribution.
  • Brush up your front end skills with Modern JavaScript: Moving Beyond jQuery by Derek Binkley.
  • Learn how and why we must of safety first when writing code in The Train Wreck: When Safety Is Discretionary by Ed Barnard .

The regular columns are all returning too including Community Corner and a new column from Chris Tankersley called "The Dev Lead Trenches". You can get more information about this latest issue, pick up a free article and get a copy of your own from the php|architect site.

tagged: phparchitect magazine july2017 safe speed issue release

Link: https://www.phparch.com/2017/07/safe-at-speed-july-2017/


Trending Topics: