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



TutsPlus.com:
What Are the WordPress PHP Coding Standards?
May 23, 2018 @ 12:51:35

On the TutsPlus.com site they've posted a tutorial sharing some of the current WordPress coding standards when it comes to both the structure and syntax of the code written in WordPress (and suggested for plugins as well).

You can find the full WordPress PHP coding standards in the tagged: wordpress coding standard tutorial example

Link: https://webdesign.tutsplus.com/tutorials/php-coding-standards--cms-31203

Joe Watkins:
PHP allows for the design of X
May 23, 2018 @ 11:20:33

Joe Watkins has a new post to his site that provides his opinions about answering the people that say "PHP wasn't designed for X".

Starting complicated twitter conversations should be avoided, I know this, and yet blurted this out on twitter recently...

This was met with a flurry of responses and I couldn't reasonably reply in tweet form. I'm going to respond to some of those tweets (indirectly) and further explain my original tweet.

He starts off by talking about how PHP isn't always the right tool for a certain job (some people's misinterpretation of his tweet). He also talks about why PHP isn't a "templating language" and has evolved so much beyond some of its original roots. He ends the post responding to the original comment, that "PHP wasn't designed for X". He talks about the opinions of those not as familiar with the current state of the language and, when they say "just because you can, doesn't mean you should" (meaning that they think you actually shouldn't).

When support emerges for a new problem domain, let's be pragmatic and observe that expanding the horizons of PHP in any direction is good for the community that relies on PHP (and maybe PHP alone) to make a living. Let's not rush to take new solutions to production tomorrow, but let's not dismiss anything out of hand because of some imaginary short coming in PHP.
tagged: opinion language design feature improvement

Link: http://blog.krakjoe.ninja/2018/05/php-allows-for-design-of-x.html

Paul Jones:
Atlas.Query: Simple. Sensible. SQL.
May 23, 2018 @ 10:43:01

On his site Paul Jones has posted about the release of a stable version of the Atlat.Query package that provides "a data mapper implementation for your persistence model" versus the domain models like many other frameworks use.

I am happy to announce that Atlas.Query is now stable and ready for production use! Installaton is as easy as composer require atlas/query ~1.0.

In the post he includes some examples of the library in use, howing how to create a connection, fine-tune the PDO settings, and perform select and insert queries. You can find out more about the library, its goals and the features it provides in the project documentation.

tagged: atlas,orm,stable,release,library,datamapper,persistence

Link: http://paul-m-jones.com/archives/6900

Laravel News:
Five Useful Laravel Blade Directives
May 23, 2018 @ 09:29:53

On the Laravel News site they've shared a list of five useful Blade directives that you may not have known about. Blade is the templating language included with the Laravel framework by default.

We’re going to look at five Laravel Blade directives you can use to simplify your templates, and learn about some convenient directives that make solving specific problems a cinch! If you’re new to the framework, these tips will help you discover the excellent features of Blade, Laravel’s templating engine.

The five on their list provide functionality to:

  1. Check if the user is authenticated
  2. Check if the user is a guest
  3. Include the first view if it exists or includes the second if it doesn’t
  4. Include a view based on a condition
  5. Include a view if it exists

Each one comes with example code showing it in use and a bit of explanation behind its use.

tagged: laravel directive blade template top5 list

Link: https://laravel-news.com/five-useful-laravel-blade-directives

Community News:
Recent posts from PHP Quickfix (05.23.2018)
May 23, 2018 @ 08:05:01

Recent posts from the PHP Quickfix site:

tagged:

Link:

Community News:
Latest PECL Releases (05.22.2018)
May 22, 2018 @ 08:05:01

Latest PECL Releases:

  • gRPC 1.12.0
    - Persistent channel and tests related fixes: #14991, #15061, #15082, #15171

    • gRPC C Core 1.12 uptake
  • gRPC 1.11.1
    - Misc C Core bug fixes
tagged:

Link:

SitePoint PHP Blog:
How to Fix Magento Login Issues with Cookies and Sessions
May 21, 2018 @ 11:30:01

On the SitePoint PHP blog there's a new tutorial posted showing how to fix Magento login issue with cookies and sessions. This issue can cause a redirect loop but can be fixed.

In this article are looking at how Magento cookies can create issues with the login functionality of both the customer-facing front-end and admin back-end, the reason it occurs and how it should be resolved.

This is also known as the looping issue, as the screen redirects itself to the same screen, even though the username and password is correct.

The post starts with some basic definitions of "cookie" and "session" and gets into more detail on how Magento stores sessions and the places it can store them. The tutorial then covers each of the cookies used and three reasons the login issues might be happening:

  • Cookie domain does not match server domain
  • Multiple subdomains used and Magento’s cookie configuration is incorrect
  • Double front-end cookies causing intermittent login issues

For each several solutions are included with any code or SQL changes that need to happen to correct it.

tagged: magento tutorial fix login issue cookie session

Link: https://www.sitepoint.com/fix-magento-login-issues-cookies-sessions/

Tomas Vortuba:
Is Your Code Readable By Humans? Cognitive Complexity Tells You
May 21, 2018 @ 10:55:07

In his latest post Tomas Votruba shares some of his thoughts around the importance of code readability and the idea of "cognitive complexity".

Cyclomatic complexity is a static analysis measure of how difficult is code to test. Cognitive complexity tells us, how difficult code is to understand by a reader.

Today, we'll see why is the later better and how to check it in your code with a Sniff.

He references this post and this PDF as sources for more information about cognitive complexity but opts for code examples to explain some of the basic concepts. He then gets into the automation of these kinds of checks, using a custom code sniff to check the complexity of the code. He walks through the installation process of the CognitiveComplexitySniff and shares some example results from its evaluation.

tagged: code readability human cognitive complexity example codesniffer tutorial

Link: https://www.tomasvotruba.cz/blog/2018/05/21/is-your-code-readable-by-humans-cognitive-complexity-tells-you/