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

Rob Allen:
Getting started with Serverless PHP
Aug 24, 2017 @ 09:19:19

In a new post to his site Rob Allen talks about getting up and running with "serverless PHP" using the Apache OpenWhisk cloud platform that executes as events are fired rather than sitting as an entire application.

I've been interested in Apache OpenWhisk for a little while now and recently submitted a new feature to add PHP support to the project. As OpenWhisk is a serverless environment, most users do not run their own copy and instead use a commercial provider with IBMs Bluemix available now along with Adobes I/O Runtime and RedHat coming soon. As a result, my contribution, isn't practically useful until it's in production with a provider.

Fortunately, and remarkably quickly, IBM have added support for PHP to the Bluemix "IBM Cloud Functions" platform, so now we can use PHP to develop serverless applications and deploy them into the wild! This is a rebranding, so you'll see this referred to as "Bluemix OpenWhisk" around the web too.

He walks you through the setup of an account on the bluemix.net service and how to install OpenWhisk locally rather than the IBM "Bluemix CLI" tool. He then shares the code to create a simple "Hello World" function in PHP (7.1) and push it up to your account. He then executes the action from the command line, returning his JSON formatted greeting. Next he shows how to set this function up as a web action and give it a URL for the outside world to access. He finishes the post with some examples of calling the URL and how it would receive parameters via a POST or a GET.

tagged: serverless development ibm bluemix function web cli tutorial

Link: https://akrabat.com/getting-started-with-serverless-php/

Fabien Potencier:
Symfony 4: Directory Structure
Apr 11, 2017 @ 11:53:59

Fabien Potencier continues his look at what's coming in the next major release of the Symfony framework (v4) in this new post to his site. In it he talks about changes to the default directory structure that Symfony 4-based applications will use.

Symfony 3 came with a slightly different directory structure than Symfony 2. Symfony 4 will also come with a reworked directory structure. Mostly incremental adjustments to support new features and best practices.

The Symfony 3 directory structure introduced a more standard Unix-like directory structure, with less sub-directories. Symfony 4 keeps going in that direction.

There's six changes he mentions specifically, each with a brief summary of what they'll contain:

  • Tests under tests/
  • Templates under templates/
  • Configuration under etc/
  • Source Code under src/
  • Temporary files under var/
  • Web files under web/

He ends the post with a quick note that, while these will be defaults, all of it is optional and these directories will be created automatically if they don't exist.

tagged: src etc template test structure directory symfony4 var web overview

Link: http://fabien.potencier.org/symfony4-directory-structure.html

Loïc Faugeron:
The Ultimate Developer Guide to Symfony - Web Example
Mar 30, 2016 @ 10:50:17

In a previous post Loïc Faugeron showed you how to take all of the components he'd talked about so far and make a simple API endpoint. In this latest post he takes the same functionality and makes a web-facing example instead.

In this guide we've explored the main standalone libraries (also known as "Components") provided by Symfony to help us build applications: HTTP Kernel and HTTP Foundation, Event Dispatcher, Routing and YAML, Dependency Injection and Console. We've also seen how HttpKernel enabled reusable code with Bundles, and the different ways to organize our application tree directory.

Finally we've started to put all this knowledge in practice by creating a "fortune" project with an endpoint that allows us to submit new fortunes.

In this article, we're going to continue the "fortune" project by creating a page that lists all fortunes.

He goes through a similar process as before, but with a few changes to make it output a web page instead of API (JSON) results:

  • Create the Controller
  • Configure related routing
  • Create the logic to list all current fortunes
  • Putting the "wiring" in place to connect it to the database
  • Creating the view to output a simple page with the fortune list

It's that last step that's different, resulting in a simple (non-templated) page being output with HTML markup. He then refactors this to use Twig as the templating output layer, removing the output generation from the application logic.

tagged: ultimate developer guide symfony web example component combine tutorial

Link: https://gnugat.github.io/2016/03/30/ultimate-symfony-web-example.html

Luciano Mammino:
6 Rules of thumb to build blazing fast web server applications
Jul 28, 2015 @ 09:48:33

Luciano Mammino has posted six tips for blazing fast web applications to his site. These tips aren't as much specific to the code (though they're related) as they are general good practices around architecture, development work and common issues.

In this post I will try to highlight some of the most common principles that you have to take under consideration when you want to achieve a great level of performance while building a web application (specifically on the backend part). I believe the concepts discussed here can be applied to any language and framework even if, due to my specific experience, I will mention some examples, design patterns, conventions and tools that are mostly used in the PHP world.

His post lists out six main rules along with some description and links to other tools for each:

  • Avoid premature optimization
  • Do the minimum amount of work to solve the problem
  • Defer the work you don't need to do immediately
  • Use cache when you can
  • Understand and avoid the N+1 query problem with relational databases
  • Prepare your app for horizontal scalability when possible

There's lots of good tools mentioned here so find one that fits your needs and helps solve the issue. There's also some good articles mentioned, giving more information about a particular topic or other perspectives on how to solve it a different way.

tagged: tips rulesofthumb fast web application optimize work cache nplusone scale horizontal

Link: http://loige.co/6-rules-of-thumb-to-build-blazing-fast-web-applications

Acquia Blog:
Web Accessibility Tips for Developers
May 08, 2015 @ 10:20:14

The Acquia blog has posted a few helpful usability tips for developers to help you think about how users will be interacting with the systems they create. This post is the first in a four part series and kicks off the content with four good tips.

Creating the code that makes a website accessible to all visitors doesn’t have to be as time-consuming or resource-intensive as you might think. All you need to do is follow some simple steps that require a little extra time and effort. [...] It’s up to both the developer and the client to achieve site accessibility. Although they usually work together in the planning and later stages of website creation, a developer and client also have separate responsibilities in making a site accessible.

In this post they touch on points around the use of "read more", clear requirements for input and good error messaging practices.

tagged: web accessibility tips series part1 readmore, requirements, input, error, message

Link: https://www.acquia.com/blog/web-accessibility-tips-developers

SitePoint PHP Blog:
Interactive PHP Debugging with PsySH
Sep 30, 2014 @ 12:53:30

The SitePoint PHP blog has a new tutorial posted by i>Miguel Ibarra Romero showing how to use the PsySH tool to do some interactive debugging of your PHP applications via both the command line and a web frontend.

It’s 1:00 a.m., the deadline for your web application’s delivery is in 8 hours… and it’s not working. As you try to figure out what’s going on, you fill your code with var_dump() and die() everywhere to see where the bug is. [...] Is this situation familiar to you? PsySH to the rescue. PsySH is a Read-Eval-Print Loop (or REPL). You may have used a REPL before via your browser’s javascript console. If you have, you know that it possesses a lot of power and can be useful while debugging your JS code.

He walks you through the install via Composer and some of the basic commands and syntax for executing PHP code inside its shell. Command line testing is good, but debugging full applications is a bit more difficult. He shows how to integrate the tool into a sample application that calls PsySH via a "debug" call and output via a set of "window" objects. He also includes a bit close to the end about debugging with unit tests, executing them from inside the shell as well.

tagged: interactive debugging psysh repl unittest commandline web

Link: http://www.sitepoint.com/interactive-php-debugging-psysh/

Three Devs & A Maybe Podcast:
Designing for the Web with Kris Jeary
Jul 08, 2014 @ 09:45:45

The Three Devs & A Maybe podcast has posted their latest episode (#32) with guest Kris Jeary to discuss "all things design" in web development.

This week we are lucky to have Kris Jeary on the show to discuss all things design. Starting off with how he got introduced to the world of web design, we move on to discuss the process he uses to create websites. We then touch upon where he gets inspiration from, and how the emergence of responsive and SPA ideologies has changed the way we think about the web. Finally, we wrap up the show with some good advice to anyone looking into getting into web design.

The show includes mentions of cron expressions in PHP, Modern.IE and CodeKit. You can listen to this latest episode either by downloading the mp3 directly or using the in-page player. If you like what you hear, consider subscribing to their feed too.

tagged: threedevsandamaybe podcast ep32 krisjeary design web

Link: http://threedevsandamaybe.com/posts/designing-for-the-web-with-kris-jeary/

Three Devs & A Maybe Podcast:
Delving into CodeIgniter
Apr 10, 2014 @ 09:22:55

The Three Devs and a Maybe podcast has released their latest episode today - Episode #19, "Delving into CodeIgniter. The show, hosted by Michael Budd, Fraser Hart, Lewis Cains and Edd Mann continues their look into web application frameworks.

In this weeks show we continue our discussion on web application frameworks by delving into CodeIgniter. Though it has had its fair share of bad press over the past couple of years, its mature code-base and ease of getting started can not be denied. Initially exploring what the framework is from a high-level we move on to discuss it's strengths and weaknesses along with personal experiences. We finally wrap up the show with a CodeIgniter influenced quiz.

Other technology mentioned includes jQuery Unveil, D3.js, the Hearbleed bug and Guzzle. You can listen to this latest episode either by downloading the mp3, using the in-page player or by subscribing to their feed.

tagged: threedevsandamaybe podcast ep19 codeigniter web framework

Link: http://threedevsandamaybe.com/posts/delving-into-codeigniter/

SitePoint PHP Blog:
Web Performance Tricks - Beyond the Basics
Jan 23, 2014 @ 11:55:28

The SitePoint PHP blog has a new post sharing some general web performance tricks that could be done to any application to speed things up a bit. Note that this is a sponsored article but it does not promote the sponsor's product.

We've had a lot of performance talk over the years here at SitePoint, and we believe it's time to revisit the topic with some more advanced aspects. The approaches mentioned in this article won't be strictly PHP related, but you can be sure they'll bring your application to a whole new level if used properly. Note that we won't be covering the usual stuff - fewer requests for CSS, JS and images meaning faster websites and similar hints are common knowledge. Instead, we'll be focusing on some less known/used upgrades.

Their list of suggestions include things like:

  • Removing unnecessary HTML tags
  • Prefetching and caching content
  • Using tools like CSS Lint and CSS Explain
  • Using Google's Page Speed tool to find bottlenecks
  • Use things like SPDY, WebP and Zopfil
tagged: web performance tips advanced list

Link: http://www.sitepoint.com/web-performance-tricks-beyond-basics/

Aura Framework Blog:
A Peek At Aura v2 -- Aura.Web
Nov 12, 2013 @ 10:34:58

Continuing their series of "sneak peeks" at the coming functionality and features of the next generation of components from the Aura framework, their blog looks at the version 2 of Aura.Web. This component has been refactored because of the creation of the Aura.Dispatcher as well.

Aura.Web v1 took the parts of Solar related to web controllers and combined them into a single independent package. [...] In the Aura.Web case, it turns out extracting Aura.Dispatcher was the key to reducing the Aura.Web package contents. With Aura.Dispatcher, any object can be a controller, since it can dispatch to any method on any object (as well as dispatching to closures). In turn, there is no more need for the Aura.Web package to provide a base controller with interfaces for various implementations.

The rest of the post explains the two halves of the new Aura.Web version - the Request and Response - and what kinds of things are included in each. It also links each to the parts of the READMEs that deal with them, providing a bit more information.

tagged: aura framework component spotlight web version auraweb

Link: http://auraphp.com/blog/2013/11/11/aura-v2-web/