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

Ibrahim Gunduz:
Sending Logs From Symfony Applications To GrayLog Through RabbitMQ
Sep 29, 2017 @ 11:17:10

On his Medium.com site ?brahim Gündüz has posted a tutorial showing you how to send logs from Symfony to Graylog via RabbitMQ, making use of backend queues to handle moving log information into the Graylog instance.

Message Queues are indispensable tools of the systems which is under high load. You can split your systems to small pieces and provide communication between each other through message queue services.

If your system happens by many pieces it means you have so many log entries which is coming from multiple application instances in same time. So you should scale your logging system like how you scaled your application also. Otherwise, your application may go down because of your logging system might be bottleneck.

You can use message queue systems to avoid this trouble.

He starts by helping you install the Composer dependencies required for the RabbitMQ interface and defining the configuration in Symfony to make the connection to the queue. With this in place he moves over to the RabbitMQ side and sets up the queue and exchange to handle the incoming log information. He then creates a LoggingTestCommand command to test out sending the logs to the queue and shows the setup of Graylog to read from that queue and pull in the information automatically.

tagged: symfony tutorial rabbitmq graylog log integration

Link: https://medium.com/@ibrahimgunduz34/sending-logs-from-symfony-applications-to-graylog-through-rabbitmq-4735aebfce4b

James Wade:
PHP CI with Jenkins and Docker (Part 1)
Sep 11, 2017 @ 09:06:28

On his site James Wade has posted the first part of a tutorial showing you how to get your PHP application set up for continuous integration with Jenkins and Docker. In this part of the series he focuses on the setup of the technology involved, linking to every tool you'll need.

I’ve been developing in PHP now for longer than I haven’t. Going from using PHP as a hammer to a nail, using it to allow forms to send emails, to operating popular open source projects, to leading a team of developers in a business enterprise. One key advice I learned from running an open source project on the SourceForge platform was “release early, release often”.

This is a mantra that I’ve always tried to stick to and its always brought me good results. As I get into more and more complex projects, both in code structure and politically, I find myself turning to tools to solve problems. One of those tools is Continuous Integration.

He talks about coding styles and IDE automation that can help make you code better and cleaner but points out that there's more to be done than just that. He briefly covers the idea behind continuous integration and why he chose Jenkins for his environment. He then gets into the setup process, showing how to get tools like PHPUnit, phploc, phpmd and phpcpd installed. He includes the dockerfile to set up this environment and the bash script that handles the setup process. He finishes the post with a brief look at the automation that happens thanks to the Jenkinsfile configuration and what's coming in part two of the series.

tagged: continuous integration jenkins docker series part1 tutorial

Link: http://wade.be/development/2017/09/03/php-ci.html

Sitepoint PHP Blog:
ReactJS in PHP: Writing Compilers Is Easy and Fun!
Aug 28, 2017 @ 11:11:10

The SitePoint PHP blog has a tutorial they recently posted from Christopher Pitt covering creating compilers in PHP and examples of it in use.

Many developers avoid writing their own compilers or interpreters, thinking that the topic is too complex or difficult to explore properly. I used to feel like that too. Compilers can be difficult to make well, and the topic can be incredibly complex and difficult. But, that doesn’t mean you can’t make a compiler.

[...] Compilers (and interpreters) begin with humble string manipulation and temporary variables. When they’re sufficiently popular (or sufficiently slow) then the experts can step in; to replace the string manipulation and temporary variables with unicorn tears and cynicism. [...] In our case, we want to maintain most of the PHP syntax, but we also want to add our own little bit of syntax on top. We could create a whole new interpreter…or we could preprocess the new syntax, compiling it to syntactically valid PHP code.

He starts off with some of the basic concepts involved with creating compilers and breaking the current code down into tokens. He shares all the code you'll need to follow along as he goes through the parsing and splitting of the tokens. He shows how to organize the tokens into a more AST-like structure and building it out into a more correct PHP structure. He ends the tutorial by taking what he's helped you create and integrate it with the Pre PHP-based precompiler as a custom compiler. He includes some examples of it in use and a simple screencast of what the end result looks like (a basic task list application).

tagged: reactjs tutorial compiler parser token pre precompile integration

Link: https://www.sitepoint.com/reactjs-php-writing-compilers-easy-fun/

Delicious Brains Blog:
How to Use Xdebug for Advanced PHP Debugging
Aug 07, 2017 @ 10:17:14

On the Delicious Brains site there's a tutorial posted that shows you how to use XDebug for advanced PHP debugging versus some of the usual practices of var_dump or print_r-ing your way through your testing.

You could just debug your PHP code using functions such as error_log, print, and var_dump, (and to be honest we’ve all done it, a lot!), but sometimes they just aren’t enough, and can actually slow you down while developing.

There must be a better way, surely?! Enter Xdebug, the rather awesome debugging and profiling tool for PHP.

In this post, I’ll take you through why Xdebug is amazing, getting it setup, how to use it, get the most out of it it, and some neat advanced uses all to make your life easier.

He starts with some background on his previous debugging practices and how discovering XDebug revolutionized his workflow. He then talks about breakpoints for debugging and what he calls "debug driven development". The article then walks you through the installation process and the integration with IDEs, specifically PHPStorm. The rest of the post shows examples of how to use XDebug along with breakpoints and IDE features to get more information about the current application state and where things are failing. He also includes sections about using XDebug for profiling and performing remote debugging via an SSH tunnel.

tagged: xdebug introduction debugging profiling tutorial setup ide integration

Link: https://deliciousbrains.com/xdebug-advanced-php-debugging/

Laravel News:
Minio: An Open-Source S3 Compliant Storage Service
Aug 07, 2017 @ 09:33:23

On the Laravel News site they've posted a tutorial showing you how to use Minio for storage and integrate it into a Laravel application as another filesystem location.

Have you ever wanted a local version of Amazon S3 while developing Laravel applications? Well want no more, Minio is an open-source distributed object storage server built in Golang. The best part: Minio is Amazon S3 compatible. Let’s go through setting up Minio locally and then try out the new temporaryUrl method introduced in Laravel v5.4.31.

They walk you through the setup of the Minio server (locally, instructions are for brew on OS X) how to access it directly to ensure it is up and running. The tutorial then shows how to integrate it into the Laravel configuration as another file system location (as it is S3 compliant). It also shows how to create a "test" bucket for the content storage and using the "Storage" handling to push a file to the Minio service.

tagged: minio s3 storage opensource laravel tutorial integration golang

Link: https://laravel-news.com/minio-s3-compliant-storage

Stefan Koopmanschap:
Customizing Sculpin: Highlight image and Facebook
Jul 28, 2017 @ 11:14:15

Stefan Koopmanschap has a new post to his site showing the Sculpin users out there how to customize the system for a highlight image and Facebook integration.

Over the past months I've been slowly customizing my Sculpin installation for this blog to fit my own liking a bit more. I've added a bit more styling including a beautiful background image and a transparent white background for the content column. Today I wanted to add a bit more. Two things specifically: I wanted to control a bit more about how my blogposts are displayed when they are shared on Facebook [and] I wanted to have an optional image at the top of blogposts to make them look a bit better.

It turns out this was actually quite easy, so here's a short description of what I did to make it work.

He splits the article into these two parts, showing how to add in custom markup and add custom frontmatter to modify the Facebook posts. He then shows how to add a block to the main templates for the highlight image and a small section to credit the photo back to the original.

tagged: sculpin facebook integration highlight image tutorial meta template credit

Link: https://leftontheweb.com/blog/2017/07/28/Customizing-Sculpin-highlight-image-and-facebook/

SitePoint PHP Blog:
How to Build a Lyrics Website with Laravel Scout and Algolia
Jul 06, 2017 @ 12:06:11

On the SitePoint PHP blog they've posted a new tutorial showing you how to create a lyrics website with the combination of Laravel Scout and the Algolia data search service.

In this tutorial, we will create a minimal lyrics web site using Laravel Scout and Algolia. To do so, we need a CRUD app to work with our data, and a search interface to let users search through the content. However, instead of creating the full app from scratch, let’s just install the finished CRUD app that we’ve created for this tutorial.

Algolia is a hosted search engine API, providing us with all the tools and resources we’ll ever need to create products with awesome search capabilities.

The end result is a site with a simple search box that displays the matching album/songs for the search string provided. They start in on the code by bootstrapping the project and setting up the database (including loading it with the included SQL file). Next they install the Laravel Scout package and update the "Song" model to be searchable. The tutorial then walks you through the creation of a Algolia account, indexing the current data and importing it into Algolia. Finally it circles back around to the site and helps you create the pieces (controller/view/etc) to make the frontend search work with the Algolia API for searching the indexed data.

tagged: tutorial algolia search laravel scout lyrics integration api

Link: https://www.sitepoint.com/build-lyrics-website-laravel-scout-algolia/

SitePoint PHP Blog:
8 Must Have PHP Quality Assurance Tools (2017 Update)
Jul 03, 2017 @ 13:43:09

As you write your PHP code, you'll need to verify that everything is working as expected and that the code follows all style and formatting requirements. In this list from the SitePoint PHP blog they give you a list of eight tools you can use to ensure all of these criteria are met.

For shipping quality code, we must have testing in mind while coding (if not doing TDD). However, with the wide range of PHP testing tools out there, it’s hard to make a choice! Exploring PHP is a fun adventure (premium course on that here!) but it’s hard to assemble a toolbelt that’s not too heavy to wear to work!

This popular article will highlight the most popular testing tools and has been updated to reflect the state of QA tools in 2017.

Included in their list are tools like:

  • PHPUnit
  • Cucumber
  • Selenium
  • Kahlan
  • php_testability

The post ends with a brief look at continuous integration and how they can help execute these tools automatically when code changes or before production builds are deployed, taking most of the burden off of developers to remember.

tagged: top8 list quality assurance tools ci continuous integration

Link: https://www.sitepoint.com/8-must-have-php-quality-assurance-tools/

Laravel News:
Invisible reCAPTCHA Integration With Laravel
Jun 09, 2017 @ 09:46:15

On the Laravel News site, there's a new post showing you how to use Google's invisible reCAPTCHA in a Laravel application with the help of the "albertcht/invisible-recaptcha" package.

Invisible reCAPTCHA is an improved version of reCAPTCHA v2 (No CAPTCHA) developed by Google, and users now only need to click the button: “I’m not a robot” to prove they are human.

In Invisible reCAPTCHA, there is no longer an embedded CAPTCHA box for users to interact with. It’s totally invisible with only a badge showing on the bottom of the page so users your website know you are using this technology. (The badge can be hidden, but this is not recommended.)

They start with an example of what the output looks like attached to a form and how to install and configure the package. This requires API credentials from the Google side: a sitekey and secretkey. The post finishes with the code you'll need in your forms and as a validator to check the reCAPTCHA code in the response.

tagged: laravel turorial invisible recaptcha integration package

Link: https://laravel-news.com/invisible-recaptcha-integration-with-laravel

Laravel News:
Developing a CI Process for Laravel with Codeship and Forge
Jun 05, 2017 @ 13:01:05

On the Laravel News site they've posted a tutorial showing you how to create a CI process for deploying Laravel applications using the Codeship and Forge services.

Codeship empowers developers to efficiently test and deploy web applications with a basic command. Today, I want to demonstrate some of the platform’s features through testing and deploying a Laravel application.

They start the tutorial with some of the things you'll need to have set up prior to the process including a local instance of Docker, a DigitalOcean or AWS account and a Laravel Forge account. The tutorial then shows how to complete the process using this sample application:

  • Setting up our Codeship project
  • Setting up Laravel Forge
  • Connecting Forge and Codeship

The article walks you through all the setup and configuration you'll need to get the process integrated and up and running quickly.

tagged: laravel deployment codeship forge tutorial integration

Link: https://laravel-news.com/ci-process-codeship-forge