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

SitePoint PHP Blog:
6 More Must-Do Grav Tweaks: Ready for Hacker News Traffic!
Aug 09, 2016 @ 11:18:52

On the SitePoint PHP blog author Bruno Skvorc continues his series about using the Grav flat-file CMS to create fast, simple sites. In his previous post he talked about the use of various "must have plugins". In this latest post he focuses more on some "tweaks" you can make to prepare your site for higher load.

We previously looked at some essential Grav plugins with which to round off the installation of a personal blog. In this post, we’ll take a look at some additional, advanced plugins, rounding it all off with an installation of Varnish for supercaching, taking performance to a whole new level.

His list of "tweaks" (and other plugins) that are recommended for a more robust site are:

  • The "Related Pages" plugin
  • An "assets" plugin for custom JS and CSS without extending the theme
  • Simple search handling
  • Comments on the content with the JsComments plugin
  • Image Optimization and CDNs
  • Caching with Varnish

All but the last item on the list are plugins you can drop in and configure pretty easily. Varnish requires a little extra setup, however, as it's an external service/software that needs to be running in front of your web server to do its job.

tagged: grav tweaks top6 plugin heavy load tutorial cms flatfile

Link: https://www.sitepoint.com/6-more-must-do-grav-tweaks-ready-for-hacker-news-traffic/

SitePoint PHP Blog:
8 Must-Have Grav Plugins to round-off Your Blog’s Installation
Aug 08, 2016 @ 10:22:52

On the SitePoint PHP blog there's a new post from editor Bruno Skvorc sharing his list of top 8 plugins for Grav he sees as "must haves". Grav is a flat-file based content management system that uses modern PHP practices such as Composer packages, Makdown for content and YAML for configuration.

I recently switched my blog over from Blogger to Grav, and while quite a nifty platform on its own, Grav really shines once you prop it up with some custom themes and plugins.

This post will list the plugins I believe to be essential for a developer’s personal blog, and the reasons behind each suggestion.

Among the plugins on his list are options like:

He includes examples of what the output of each looks like when integrated into the site and how to get them installed and configured. Check out the remainder of the post for more in his list of suggestions.

tagged: grav plugin blog installation example top8 list

Link: https://www.sitepoint.com/8-must-have-grav-plugins-to-round-off-your-blogs-installation/

TutsPlus.com:
Building a WordPress-Powered Front End With the WP REST API and AngularJS: Intro & Set
Aug 05, 2016 @ 11:17:36

The TutsPlus.com site has kicked off a new tutorial series today with part one of a look at using the WordPress REST API and AngularJS to create an API-powered frontend application.

In this series about building a WordPress-powered front end with the WP REST API and AngularJS, we will put the knowledge acquired in the introductory series to use. We will learn how we can leverage this knowledge to decouple the conventional theme-admin model supported by WordPress until now. We will plan and build a single-page application (that I've named Quiescent) with a WordPress back end which will feature posts, users, and categories listing pages. We will configure AngularJS routing and build a custom directive and controllers for the resources mentioned above.

In this first part of the series they walk you through some of the planning steps before the application even gets written (including wireframes). From there they get a bare-bones HTML structure setup for the Angular app to live in and make a matching WordPress plugin. This plugin will return a featured image, author name, associated categories and image resize data related to a post. The code for the plugin is included.

tagged: wordpress api frontend angularjs tutorial plugin wireframe planning series part1

Link: http://code.tutsplus.com/tutorials/building-a-wordpress-powered-front-end-with-the-wp-rest-api-and-angularjs-introduction-and-setup--cms-26115

TutsPlus.com:
How to Program With Yii2: Uploading Files
Jul 15, 2016 @ 12:15:45

On the TutsPlus.com site there's a new installment in their "How to Program With Yii2 Series" looking at implementing file uploads with some simple examples.

In this How to Program With Yii2 series, I'm guiding readers in use of the Yii2 Framework for PHP. In this tutorial, I'll guide you through the basics of uploading files and images in Yii2.

For these examples, we'll continue to imagine we're building a framework for posting simple status updates, e.g. our own mini-Twitter. The image above demonstrates writing a short update while uploading a picture I took of the Taj Mahal.

They start with a look at some of the file upload plugins that seemed like the best they found to use with Yii2: FileInput and the 2Amigos BlueImp File Uploader. They go with the first option for the rest of the tutorial, showing you how to get it installed (via Composer), updating your current database tables and changing the model to reflect these updates. Next they help you create the view with the image upload form and one to display the image result once the upload is successful (including the controller code needed).

tagged: yii2 framework series tutorial upload files plugin

Link: http://code.tutsplus.com/tutorials/how-to-program-with-yii2-uploading-files--cms-23511

TutsPlus.com:
Internationalizing WordPress Projects: A Practical Example, Part 1
Jul 06, 2016 @ 10:50:43

Tom McFarlin has continued his series covering internationalization in WordPress applications with this latest part of the series. In the previous part of the series he introduced some of the basic topics and terms. In this new tutorial he gets more into functionality creating the plugin he'll use in his examples.

Given that WordPress powers roughly 25% of the web and that the web is not local to your country of origin, it makes sense to ensure that the work that we produce can be translated into other locations.

To be clear, this does not mean that you, as the developer, are responsible for translating all of the strings in your codebase into the various languages that your customers may use. Instead, it means that you use the proper APIs to ensure someone else can come along and provide translations for them.

He then walks you through the download of the latest WordPress version (a Subversion checkout) and the creation of the plugin structure. He provides sample code to define the plugin and shows how it should look in the "Plugins" listing. He helps you add in the menu item with internationalized strings for the link text. They help you add a simple screen for the plugin and help you style the page a bit. The post ends with a brief mention of object-oriented programming but points out that OOP introduces other, not necessarily related, topics that could detract from the WordPress-related content (and so will not be used).

tagged: wordpress internationalization i18n tutorial series part2 plugin example practical

Link: http://code.tutsplus.com/tutorials/internationalizing-wordpress-projects-a-practical-example-part-1--cms-26676

Joe Ferguson:
Validating and Releasing Packages with Producer
Mar 29, 2016 @ 10:49:50

In this post to his site Joe Ferguson takes a look at the recently announced Producer package that helps with ensuring your packages are "high quality" and makes the release process easier.

Producer is a pretty neat project that wants you to release higher quality packages. Well, actually (sorry) it’s “a command-line tool to validate, and then release, your PHP library package. It supports Git and Mercurial for version control, as well as Github, Gitlab, and Bitbucket for remote origins.”

[...] I was immediately interested in this tool because the Phergie project I manage (with other awesome developers) contains a number of individual packages. [...] Phergie packages are pretty solid. We have Travis CI running our tests across multiple PHP versions, we have hours and hours into these packages. But I wanted to take it to the next level, step up our game so to speak. In order to help raise our quality control on our packages I needed a producer.

He uses a Phergie plugin he developed as an example to try out Producer. He shows the results of the validate call with Producer and the few issues it reports. He shares the updates he made to the code (documentation) and the addition of a CHANGES.md file to the repository.He then uses Producer to push out a new version of the package using the release command (v3.0.1) and the resulting output of the command.

tagged: producer package validate release phergie plugin example tutorial

Link: https://www.joeferguson.me/validating-and-releasing-packages-with-producer/

SitePoint PHP Blog:
Drunk with the Power of Composer Plugins
Mar 28, 2016 @ 13:54:25

The SitePoint PHP blog has a new tutorial for the Composer users out there talking about Composer plugin development and how they can add functionality to this already powerful tool.

Composer is the sharpest tool in the toolbox of the modern PHP developer. The days of manual dependency management are in the distant past, and in their place we have wonderful things like Semver. Things that help us sleep at night, because we can update our dependencies without smashing rocks together.

[...] Even though we use Composer so frequently, there’s not a lot of shared knowledge about how to extend it. [...] Yet, recent changes have made it much easier to develop Composer plugins. [...] So, today I thought we would explore the possibilities of Composer plugin development, and create a fresh bit of documentation as we go.

He walks you through the creation of a simple plugin: one that tracks users and the dependencies they require. He shows you how to create the initial plugin boilerplate and the creation of the addDependencies and activate methods. These grab the dependencies being added and send the information off to a remote site.

tagged: composer plugin tutorial dependency tracking introduction

Link: http://www.sitepoint.com/drunk-with-the-power-of-composer-plugins/

SitePoint PHP Blog:
Theming Views in Drupal 8 – Custom Style Plugins
Mar 24, 2016 @ 12:40:30

The SitePoint PHP blog has another post in its series about working with Drupal 8. In this new tutorial author Daniel Sipos talks about theming views in the content management system and introducing custom style plugins.

In this article, we are going to look at how we can create a custom Style plugin for Views in Drupal 8. We will use the Bootstrap tab markup as a goal and implement a tabbed output for our View results. In the View configuration, the Style settings will allow us to specify which field will be used as the tab navigation copy, leaving the rest of the fields shown in the respective tab panes. Basically, each View result will represent a tab – so this example is not suited for Views which have more than a few results. The main goal is to illustrate how we can create our own Views Style plugins in Drupal 8.

He starts by talking about Style plugins - what they are and where they fit in the application execution flow. He then walks you through the creation of the custom style plugin to integrate the Bootstrap tabs. This also includes the creation of the theme and the matching template to build out the tab markup.

tagged: drupal8 theme view custom style plugin tutorial

Link: http://www.sitepoint.com/theming-views-in-drupal-8-custom-style-plugins/

Robert Basic:
Tags for PHP in Vim
Mar 10, 2016 @ 11:32:34

In a post to his site Robert Basic has shared some helpful plugins for PHP developers using Vim as their primary editor. These plugins not only help you jump around in your code but get more context on where you're at.

One thing I was missing for a long time in Vim is to be able to "jump to definition" in an easy and painless way. The other thing I wanted to improve is to be able to tell easily where am I actually in the code base; to see the current class and method name of wherever the cursor was.

With a bit of googling and poking around, I finally came up with a perfect combo of 5 plugins (yep, five!) that enables me to do both, and a little bit of extra.

He shows examples of using three different things he wanted to be able to do when working in his code and the plugins that satisfy each:

One line examples are included showing how to configure them with your current Vim use.

tagged: tags vim plugin jump definition context class method

Link: http://robertbasic.com/blog/tags-for-php-in-vim

Mark Scherer:
Developing CakePHP 3+ Plugins, it’s fun!
Feb 01, 2016 @ 12:08:04

Mark Scherer has a post to his site looking at developing CakePHP 3+ plugins, showing how it's much easier than it used to be with previous versions of the framework.

he days of CakePHP 2 plugins and how difficult it was to actually develop plugins are over. Back in the days (OK, I still have to do it once in a while), there was even an app required to test a plugin. Since you didn’t want to have a boilerplate app for each plugin, you usually worked in your actual app. So you had cross contamination from that messing up your tests and stuff. Really annoying.

[...] While most of the concrete examples are about plugin development for CakePHP 3, the main ideas apply to all library code you write. And if you are a developer for other frameworks, the same principles apply, only the concrete implementation might differ.

He starts with the "real story" behind his development of a plugin - a need to integrate hashid support into a CakePHP v3-based application. He uses his own library as an example (here on GitHub) and shares his thought and development process in its creation. He then shares a few helpful tips for the would-be plugin authors out there:

  • Thinking about what should be in core vs a plugin.
  • Try to follow coding and package principles.
  • Following the six package principles including common reuse, common closure and package coupling practices.
tagged: cakephp3 framework plugin example principles tips hashid

Link: http://www.dereuromark.de/2016/01/29/developing-cakephp-3-plugins-its-fun/