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

Liip Blog:
Magento 2.0 Release
Nov 19, 2015 @ 09:40:01

On the Liip blog there's a post about the release of Magento 2, the latest and hugely reworked version of the popular eCommerce platform. The post walks you through the installation of this latest update using a pre-configured Vagrant machine.

I’ve downloaded my M2 sample from the official Magento website, there I also found an archive with sample data. For a setup I used a pre-configured Vagrant machine according to the installation guide for Magento server. This installation guide offers two options: easy and advanced. Let’s try the easy way first ;) M2 has an installation wizard, so it is supposed that even a none technically prepared user can install it successfully. And indeed, it looks easy.

He walks through some of the issues he had importing the data during the installation, ultimately, falling back to a command line call to push the large sample data into the platform.

You can find out more about this release and get the latest version over on the Magento website with plenty of information about what's been improved, added and how to get started using this latest version.

tagged: magento2 release install import data ecommerce platform

Link: https://blog.liip.ch/archive/2015/11/18/magento-2-0-release.html

Tyler Longren:
Use Composer in Your WordPress Plugin or Theme
Nov 16, 2015 @ 10:22:47

In this post to his site Tyler Longren shows how to use Composer to install WordPress plugins as well as the usual libraries.

I love Composer. It just makes including libraries or scripts in your app incredibly easy. So easy that it’s stupid not to use it (in many, if not most cases).

[...] I'd never used Composer with a proprietary WordPress plugin before. The plugin is for a client so it’ll never be available to the public. Here’s the steps I took to make this WordPress plugin compatible with Composer so that I can easily bring in third-party libraries.

He breaks it down into a five step process, showing the installation of the Mailgun PHP client:

  • Install composer on your server
  • Add Mailgun as a dependency
  • Check your composer.json file
  • Tell composer to install Mailgun
  • Autoload Our Mailgun Classes in Our Plugin

With the help of Composer, the Mailgun client is ready to go and accessible in his WordPress instance, quickly and easily.

tagged: composer wordpress plugin mailgun client install autoload

Link: https://longren.io/use-composer-in-your-wordpress-plugin-or-theme/

SitePoint WordPress Blog:
How to Install and Use WP-CLI to Manage WordPress Websites
Nov 04, 2015 @ 09:19:13

On the SitePoint WordPress blog they've posted a tutorial showing you how to install and use the WP-CLI tool to manage your WordPress-powered websites.

Speeding up your work process should be one of your top priorities. Simply put, if you do more work in less time, then you will have more time to work on more projects, study and rest. WP-CLI is one of the command line tools specifically made to manage your WordPress websites through the command line. With a few simple commands, you can manage WordPress without even needing to login to your WordPress admin and navigate through the pages.

They start with some of the requirements to use the WP-CLI tool and follow it with the steps to get it installed and moved to the right place on your system. They then show off some of the functionality the command-line tool has to offer including:

  • working with the WP cache
  • installing WordPress core
  • installing themes and plugins

The WP-CLI tool also helps you keep your WordPress installation up to date, including core and themes/plugins too.

tagged: wordpress tutorial wpcli commandline tool install

Link: http://www.sitepoint.com/wp-cli/

Marc Morera:
Composer Install in CI
Sep 29, 2015 @ 10:48:38

In this post to his site Marc Morera talks about Composer dependencies and an issue that can come up with two things: having a large number of dependencies and minimum PHP version requirements (and when they change).

Any final project needs a lot of dependencies, and even if your composer.json file is small, you may need a dependency with a lot of dependencies. [...] Computing the real dependencies in my environment seems a great solution, right? I run composer update in my computer, I update the composer.lock version in the repository, and then I only need to do composer install. What I reduce here is the computing time of all recursive dependencies from 20+ minutes to less than 5 minutes. [...] Why this is a bad solution?

He explains that some projects will change the PHP version requirement in a minor version, potentially causing your build to break on other versions without you changing anything. He points out that there's "no good solution" he sees but does recommend good upkeep of your composer.json as a composer update is the best course of action. He also makes recommendations to the library developers about keeping requirements scope as wide as possible and only defining specifics when the project is finalized.

tagged: composer install continuous integration update dependencies

Link: http://mmoreram.com/blog/2015/09/28/composer-install-in-ci/

Barry vd. Heuvel:
Using local repositories to easily install private Magento extensions with Compose
Sep 22, 2015 @ 09:02:26

In a post over on Medium.com Barry vd. Heuvel shows you how to use a recently added feature of Composer, the ability to use local repositories, to install Magento extensions quickly and easily.

I’m a fan of using Composer (in- and outside Magento), so I like to use that option. This works great for free packages listed on Magento connect or Firegento Packages, because you can just require the packages and run composer update. [...] This is all great for public packages, which are download through the Firegento repository. But what about private packages? Ideally we could also use Composer for the packages we purchase. [...] In this blog I’d like to explain how to tackle these 2 problems, so you can keep using the Composer workflow.

He walks you through the two steps you'll need to set up the module so it can be installed via Composer: creating a mapping (package.xml) and the composer.json. For the first he recommends using the Magerun modman tool to help with this. Creating/updating thecomposer.json file to work with the extensions is relatively easy. He makes use of the "path repositories" functionality to points the package at the "extensions/" directory using wildcards in the path name to allow for inclusion of all extensions without having to list each one (see this PR). Finally, to help make the process a bit more clear, he walks through a full example using the Amasty module.

tagged: magento composer install local repository extension packagexml tutorial

Link: https://medium.com/@barryvdh/using-local-repositories-to-easily-install-private-magento-extensions-with-composer-7eb966dec23e

Laravel News:
Installing Zend Z-Ray on Homestead
Aug 25, 2015 @ 10:45:01

On the Laravel News site there's a tutorial posted showing you how to Install the Zend Z-Ray tool on Homestead, the popular Laravel-related virtual machine environment. This tool helps with debugging applications by giving you an inside look (a sort of "x-ray") into its inner workings as it executes.

For the past week or so I have been running Zend Z-Ray in Laravel Homestead. Every time using it, new features come to light that are fantastic for debugging your apps in development! What follows is a quick preview of Z-Ray, along with all the steps necessary to install it on Laravel Homestead.

He talks some about the Z-Ray tool and the features it has to offer as well as some of the technologies it supports. He also covers some of the Laravel specific features included like project information, route inspection and current user information. He then gets into the Administration panel, what kinds of information it provides and, finally, how to get it all installed and working. It's not a super simple process but all the commands you'll need are included in the post.

tagged: install zray zend tool plugin laravel tutorial inspect

Link: https://laravel-news.com/2015/08/installing-zend-z-ray-on-homestead/

Rob Allen:
Slim-Csrf with Slim 3
Aug 25, 2015 @ 09:49:48

In a post to his site Rob Allen shows you how to help secure your Slim 3-based applications with the help of the slim3-csrf package. A CSRF (cross-site request forgery) attack happens when another site requests a page in your application, possibly performing an action.

In addition to the core Slim framework, we also ship a number of add-ons that are useful for specific types of problems. One of these is Slim-Csrf which provides CSRF protection. This is middleware that sets a token in the session for every request that you can then set as an hidden input field on a form. When the form is submitted, the middleware checks that the value in the form field matches the value stored in the session. If they match, then the all is okay, but if they don't then an error is raised.

He shows how to add the middleware to your Slim 3 application and how to add the token to each form. The library generates random values for both the name of the token and the value making it compatible with applications that may involve multiple browser windows. He also shows you how to validate the token, either using the built-in "Guard" handling or manually by deferring the check to the route.

tagged: slim3 csrf token package library install configure validate

Link: http://akrabat.com/slim-csrf-with-slim-3/

Dayle Rees:
PHP: The Composer Lock File
Aug 24, 2015 @ 09:17:10

Dayle Rees has a post to his site help to demystify the composer.lock file for the Composer users out there - what it's for, how it works and why you may or may not want to have it in version control.

Everywhere that I go, conference, the supermarket, the dentist, building sites, people always ask me about the Composer lock file. It's a mystery that seems to cause confusion all across the globe. Well, boys and girls, I'm here today to de-mystify the lock file once and for all.

He starts with a new project and some simple dependencies (three of them), two with specific versions defined and one with a wildcard. Once a composer install is run, the packages are downloaded and the composer.lock file is created. He talks about the contents of the lock file and how they relate to the version of the library Composer has installed, the exact version to be precise. He then gets to the question many wonder about the lock file - should I commit it to my version control system? He suggests that, if you need exact versions installed, then yes. This helps keep versions the same across the board of a team and ensures other people working with the library are using compatible library versions. He ends the post talking about how to use the lock file (install vs update) and what changes could be made in one versus the other.

tagged: composer lock file composerlock indepth update install tutorial

Link: http://daylerees.com/the-composer-lock-file/

Debugging WordPress with Zend Server and Z-Ray on AWS
Aug 05, 2015 @ 11:57:02

The Zend.com blog has a post showing you how to debug WordPress running on Zend Server with the help of the Z-Ray plugin. In their example they're hosting it on an AWS instance, but the same technique can apply on any other hosted version as well.

More and more PHP development is being done in the cloud and on virtual platforms nowadays. The workflow detailed in this brief tutorial is just one way to develop PHP in these environments, but it illustrates just how easy and productive this type of development can be. More specifically, it demonstrates how to launch the newly available Zend Server 8.5 instance on AWS with a WordPress application already deployed, and then use Z-Ray to introspect and debug the code.

The tutorial walks you through the setup and configuration of a new AWS instance with Zend Server and WordPress installed (you can skip to the end if you already have this). They show you how to:

  • Launch the Zend Server AWS instance
  • Configure the instance to install WordPress as a part of the setup process
  • Access the Zend Server control panel
  • Accessing the WordPress application deployed on the instance

Once the WordPress application is accessed, the Z-Ray inspection bar will appear at the bottom giving you insight into various configuration options, performance metrics and server information. They also link to a video with more information about the WordPress plugin.

tagged: zendserver wordpress aws amazon instance zray debug tutorial install configure

Link: http://blog.zend.com/2015/08/04/debugging-wordpress-with-zend-server-and-z-ray-on-aws

SitePoint PHP Blog:
Introduction to Elasticsearch in PHP
Aug 04, 2015 @ 09:31:05

The SitePoint PHP blog has posted an introduction to using Elasticsearch in your PHP applications. In it author Wern Ancheta covers some of the basics of this powerful tool and helps you get an example script up and running for testing.

In this tutorial, we’re going to take a look at Elasticsearch and how we can use it in PHP. Elasticsearch is an open-source search server based on Apache Lucene. We can use it to perform super fast full-text and other complex searches. It also includes a REST API which allows us to easily issue requests for creating, deleting, updating and retrieving of data.

He starts by helping you get Elasticsearch itself installed via the apt-get package manager (may slightly differ depending on your OS of choice) and tested with a simple web-based request to the port the server is running on. With the server set up he then moves on to the PHP aspect, helping you get the elasticsearch library installed via Composer and creating a new client instance. He then includes code examples of some of the main operations you'll perform with entries in the Elasticsearch instance: inserting a document, updating a document, deleting and - of course - searching for documents matching certain simple and more complex criteria.

tagged: introduction tutorial elasticsearch install library insert update delete search

Link: http://www.sitepoint.com/introduction-to-elasticsearch-in-php/