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

php[architect]:
It’s About Time
Jan 07, 2019 @ 12:08:02

On the php[architect] site they've shared an article from their December 2018 edition by Colin DeCarlo and issues with dates and times that most developers deal with at some point in their careers.

As applications scale and gain adoption, dates and time become much more of a concern than they once were. Bugs crop up, and developers start learning the woes of time zones and daylight saving time. Why did that reminder get sent a day early? How could that comment have been made at 5:30 a.m. if the post didn’t get published until 9:00 a.m.? Indiana has how man time zones?!

Luckily, PHP developers have the tools they need to face these problems head-on and take back control of their apps.

The article covers some of the basics of "time" and some of the concepts that PHP uses to measure it. It then introduces the different time functionality that PHP offers including timestamps and functions like strtotime and date as well as the DateTime handling. They dig into this last one in more detail before talking about timezones and date arithmetic.

tagged: article phparchitect magazine date time datetime introduction tutorial

Link: https://www.phparch.com/2018/12/its-about-time/

Community News:
24 Days in December 2018
Dec 18, 2018 @ 12:24:50

The "24 Days in December" project has returned this year, sharing opinions and insights from members of the PHP community, one article posted each day. They've been running since December 1st and there's some great content in this year's batch already:

...and many more. Be sure to check out the full list and keep checking until December 24th of this year for more great articles from this year's 24 Days in December project.

tagged: 24daysindecember community project article advent

Link: https://24daysindecember.net/

php[architect]:
The Case for Generics in PHP
Dec 04, 2018 @ 14:30:55

The php[architect] site has posted an article pulled from their November 2018 issue providing a case for generics in PHP.

To elucidate their merit, we will look at how they might fit within the evolution of PHP’s type system to put us in a position to write more robust software:

“How can I signal that my method will return a Collection of User objects? And why would I want to do that?”

The article starts with a look at generics in other languages and how they're handled (such as Java and C#). From there they shift over to PHP, giving a code sample of a class that is typed to only accept one kind of value for its constructor. They provide an update for this that would work in PHP 7.4 (with typed properties) and how with the help of generics it would be simpler to define a more dynamic type requirement, allowing for more generalized class descriptions.

tagged: phparchitect article november2018 issue generics tutorial php74

Link: https://www.phparch.com/2018/11/the-case-for-generics-in-php/

php[architect]:
Self-Host Your Team’s Git With Gitolite
Jun 15, 2018 @ 11:17:12

On the php[architect] site they've shared a post from their most recent issue (June 2018 - Command and Control) from author Gabriel Zerbib covering self-hosting Git with Gitolite.

If you wish to set up a private Git server for your personal, work, or team projects, but favor free software and simple architecture, or don’t want a service hosted by a third party, then Gitolite is the solution for you.

The article starts with a brief history of Git and a listing of some of the options for hosting private Git repositories. It then gets into talking about Gitolite, a "collection of Perl scripts, wisely arranged to allow easy management of Git repositories served over the SSH protocol." He talks through some of the features that come along with the tool and how to get it installed. With that setup, he shows how to use it as a Git hosting platform, how to configure repositories, create and configure users, and perform backups. The post ends with some helpful troubleshooting tips and a look at Gitolite's hook system.

tagged: gitolite phparch june2018 article git hosting tutorial introduction

Link: https://www.phparch.com/2018/06/self-host-your-teams-git-with-gitolite/

php[architect]:
Testing Strategy With the Help of Static Analysis
Apr 30, 2018 @ 12:49:41

php[architect] magazine has shared another article from their April 2018 issue on their site. In this article Ondrej Mirtes covers the use of static analysis to help testing and inform you of type safety issues.

When developing an application, our aim as software developers is to make sure it does what it ought to do and to keep the number of defects as low as possible. [...] In this article, I’d like to introduce you to the concept of type safety and how it can improve the reliability and stability of your code. Once your code is more type-safe, and that fact is verified by automated tools, you can cherry-pick which parts of your application need extensive unit tests and where you can rely just on well-defined types.

He starts off by talking about types (strict and dynamic) in PHP and the current state of the typing system for variable values. He covers the role of good type hinting in method and function definitions and how it can help IDEs like PhpStorm locate issues. He also talks about how type hints can provide you feedback on the design of the application and some of the tools that can help you find issues.

He wraps up the article with some tips for making your code more strongly typed and a look at what kind of tests are needed to help ensure these types remain enforced.

tagged: testing staticanalysis help article tutorial tools

Link: https://www.phparch.com/2018/04/testing-strategy-with-the-help-of-static-analysis/

php[architect]:
The Dev Lead Trenches: Reviewing Code
Mar 26, 2018 @ 11:24:58

On the php[architect] site they've shared an article from their latest edition of the magazine (the March 2018 issue) about reviewing code from the "Dev Lead Trenches" column (by Chris Tankersley).

Code reviews are one of the best ways to help a team ensure they’re writing the best code possible. In all of the jobs where we have done peer-lead code reviews, we have caught more bugs and had better discussions about code than in places or times where we just hammer code through the approval process. I know, I know; we all write beautiful, bug-free code, so why go through the hassle of a code review?

He starts with the idea of relating code reviews back to test-driven development. In TDD the architecture and quality thinking comes up front and with code reviews that same kind of thinking happens with the second (or third) set of eyes as the code progresses. He then lists out a few helpful tools for code reviews including GitHub/GitHub Enterprise's own pull request system and similar features in Gitlab. He ends the post with some suggestions for successful code reviews including "don't punish", "ask questions" and "have clear intentions" (avoid vague questions).

tagged: phparchitect march2018 article codreview development lead

Link: https://www.phparch.com/2018/03/the-dev-lead-trenches-reviewing-code/

Laravel News:
The Best of Laravel News 2017
Jan 03, 2018 @ 10:19:13

The Laravel News site has posted a look back at their content for all of 2017 and have linked to the best based on their popularity over the year.

Here’s a look at the most popular articles we wrote this year, including the major release of Laravel 5.5, command line tips, Vue.js tutorials, bash tricks, and of course, popular Laravel tutorials.

The list includes articles like:

Check out the full post for the complete list and a brief summary for each.

tagged: laravelnews laravel bestof 2017 list article tutorial

Link: https://laravel-news.com/best-2017

Community News:
24 Days In December
Dec 18, 2017 @ 10:46:02

The "24 Days in December" project is an effort to share "thoughts from the PHPamily", members of the PHP community from all levels of experience and "age" in the community. For the month of December they've posted several articles, each from a member of the community building up to Christmas. If you haven't been reading along, here's a selection of the posts so far:

These are just a few of the great articles so far so be sure to check out the full list for perspectives and thoughts from other members of the community.

tagged: 24daysindecember community article experience december

Link: https://24daysindecember.net/

Michael Cullum:
A month of PHP FIG #1: October 2017
Nov 03, 2017 @ 10:52:47

Michael Cullum has posted the October 2017 edition of what has been happening in the PHP-FIG group for the month over on Medium.com.

As part of the effort to communicate better what’s going on within the PHP FIG we’re starting a new series of ‘A month of PHP FIG’ articles to be released towards the end of each month, each being a 2 minute read or less.

Topics mentioned in this month's edition include:

  • PSR-12 being formally re-introduced into the draft stage
  • a start of the voting for the secretary elections for two secretary posts
  • a discussion as to whether or not new PSRs should require PHP 7 or PHP 5 still
  • an agreement that PSR-18 will not cater to async http client requests due to the lack of a Promise PSR standard

There were also several new PSR ideas proposed including ones for internationalization, cache tagging and deprecation handling. You can read the full post here

tagged: phpfig monthly article october2017 psr

Link: https://medium.com/php-fig/a-month-of-php-fig-1-october-2017-af253682ef5b

php[architect]:
Community Corner: PHP TestFest Has Returned!
Sep 22, 2017 @ 13:31:08

On the php[architect] site they've posted an article from the September 2017 issue - the "Community Corner" from James Titcumb all about the return of PHP TestFest.

There is a new movement in the PHP community! Well, it isn’t exactly new, but an event called PHP TestFest is back. PHP TestFest is a global event organized by the PHP community at large, where an effort is made each time to increase the test coverage of the PHP engine itself. Around eight or nine years ago, user groups around the world coordinated to organize events spanning a few months each year, with some groups continuing events annually for several years after.

The article goes on to talk about some of the reasoning behind the TestFest and how you can help to set up an event for a local group to contribute. It then goes through the format of tests, creating new ones and how to execute them to test the result. You can find out more about PHP TestFest and how you can get involved on the main PHP TestFest site.

tagged: phptestfest phparchitect communitycorner article sept2017 issue

Link: https://www.phparch.com/2017/09/community-corner-php-testfest-has-returned/