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

Christoph Rumpel:
The BotMan WebDriver explained
Feb 14, 2018 @ 10:23:10

In this post to his site Christoph Rumpel covers a feature of the Botman chatbot library in a bit more depth: the WebDriver making interaction with the bot in a current application simpler.

The WebDriver is one of the best features about the BotMan library. Still I see a lot of people struggling with the concept and how to use it. Let's clear things up and let me show you how I already used this driver in production.

He starts off by talking about chatbots in general and how they're "more than just messengers" and can provide more real-time information to visitors to your site. In order to enhance the basic bot functionality, it needs to work with another source - in this case an API accessed via the WebDriver. He then gets into some example code showing how to use the driver to access an API and some explanation of the pieces involved.

tagged: botman chatbot webdriver driver tutorial introduction example

Link: https://christoph-rumpel.com/2018/02/the-botman-webdriver-explained

Cees-Jan Kiewiet:
ReactPHP with RecoilPHP: An introduction
Feb 05, 2018 @ 09:51:01

In a new post to his site Cees-Jan Kiewiet has posted in introduction to using asynchronous processing in your PHP application by using RecoilPHP and ReactPHP.

Getting your mind wrapped around async nature can be mind bending at first. But with RecoilPHP you can write code promise as if you're writing sync code.

He starts with some sample code showing the difference between normal ReactPHP and how the same kind of thing would be written using RecoilPHP. He then gets into the setup of a project that includes the RecoilPHP package and several others from React. With that base set up, he shows how to create a promise that opens a socket and listens on it for incoming messages and how to modify it to add additional coroutines. Finally he shares a few "bonus tips" and covers error handling.

tagged: recoilphp reactphp tutorial introduction asynchronous processing promise

Link: https://blog.wyrihaximus.net/2018/02/reactphp-with-recoilphp/

TutsPlus.com:
Exception Handling in Laravel
Feb 01, 2018 @ 09:37:18

In this new tutorial from the TutsPlus.com site they introduce you to the exception handling that comes along with the Laravel framework and how you can work with it in your own applications.

In this article, we're going to explore one of the most important and least discussed features of the Laravel web framework—exception handling. Laravel comes with a built-in exception handler that allows you to report and render exceptions easily and in a friendly manner.

In the first half of the article, we'll explore the default settings provided by the exception handler. In fact, we'll go through the default Handler class in the first place to understand how Laravel handles exceptions. In the second half of the article, we'll go ahead and see how you could create a custom exception handler that allows you to catch custom exceptions.

You'll need to have a Laravel instance set up already to follow along (instructions not provided here). The tutorial starts with a change to the base configuration for the "APP_DEBUG" and "APP_LOG" settings to enable/disable the error handling and output. Next comes a look at the base exception class for the framework - code included - and a closer look at its report and render methods. Finally it gets into the creation of a custom exception class including the code required to create it and where it should be located in the application for use.

tagged: exception handling laravel tutorial introduction error logging

Link: https://code.tutsplus.com/tutorials/exception-handling-in-laravel--cms-30210

CloudWays Blog:
What To Expect From Laracon Online 2018
Jan 30, 2018 @ 10:25:12

On the Cloudways blog there's a new post sharing some of the things you can expect from the Laracon Online conference happening February 7th. As its name implies, Laracon Online is a one-day, single track conference happening completely online.

The entire Laravel community is pretty excited about the upcoming Laravel Event of the Year – Laracon Online 2018. The webinar will be streamed online on 7th Feb 2018. It is expected that the entire who’s who of the Laravel community will attend the event.

Laracon Online is perhaps the most important event where more than eight renowned speakers and over 6000+ attendees from around the globe. The conference addresses multiple areas of interest but the focus remains on in-depth technical talks given by Laravel experts.

The article spends some time giving a little background about the conference and the Slack instance that will be used for attendee communication. Speakers at this year's event include well-known names in the Laravel community like Matt Stauffer, Adam Wathan and Taylor Otwell. The article also includes several tweets from both speakers and the Laravel community, excited about the upcoming event. If you're interested in attending you can find out more about the conference and pick up a ticket from the main Laracon Online conference website.

tagged: laracononline18 laracon conference introduction online

Link: https://www.cloudways.com/blog/laracon-online/

Delicious Brains Blog:
WP-CLI Packages: Supercharge Your WordPress Development
Jan 24, 2018 @ 11:55:59

The Delicious Brains site has a tutorial posted showing you how to supercharge your WordPress development with the help of WP-CLI packages.

I think most developers would agree that my-hacks.php. It is my favorite way to set up new WordPress sites, control WordPress with CRON, manage plugins, quickly test code, and a whole host of other tasks that are quicker and easier to complete via the CLI or a shell script.

“What,” you might ask, “could possibly be better than WP-CLI?”. “A lot of things…” I would reply [...] but then I might catch myself and realize that your question was probably scoped to WordPress development and related tools so I would cough loudly and continue, “cough I mean… Packages… For WP-CLI. WP-CLI Packages”

The post then goes on to talk about the WP-CLI package index and some of the packages they like to use including:

  • aaemnnosttv/wp-cli-login-command
  • binarygary/db-checkpoint
  • markri/wp-sec

Each includes a brief summary of what the package offers and a code example of it in use. The post ends with some unfortunate news, however - that the package index is essentially dead.

tagged: wpcli packages index tutorial introduction list

Link: https://deliciousbrains.com/wordpress-cli-packages-review/

php[architect]:
Security Corner: PHP, meet Libsodium
Jan 22, 2018 @ 11:02:33

On the php[architect] site they've posted an article that appeared in their December 2017 issue, an article that introduces Libsodium (by Eric Mann), a new addition to PHP's "security toolbelt" for encryption.

By the time you read this, the PHP community should have introduced the world to the newest version of our favorite language. This latest version adds better support for type annotations, allows trailing commas in lists (just like JavaScript and other dynamic languages) and introduced several security improvements. The most notable security addition, however, is the introduction of the Sodium cryptographic library as a core extension.

In the article he covers the basics of the Sodium library (that libsodium is built on top of) and what makes it different from other encryption methods. He also talks about what's been done to support it on pre-PHP 7.2 versions including the sodium_compat polyfill library and the PECL extension for PHP 7.0+. Example code is included showing how to use this new functionality via native functions once support for it has been compiled in.

tagged: phparchitect magazine securitycorner introduction libsodium encryption

Link: https://www.phparch.com/2017/12/security-corner-php-meet-libsodium/

Exakat Blog:
PHP assertions and their usage
Jan 18, 2018 @ 11:16:58

On the Exakat blog there's a post that covers assertions in PHP, a built-in tool the language provides to help perform simple value based evaluation against certain criteria.

PHP has a clever native debugging tool : the PHP assertions. In a nutshell, assertions are a function call to assert(), that triggers an error when a condition is not satisfied.

[...] Unlike debugging conditions, the assert() syntax has to be read in a positive way. When the condition, aka as the first argument, is satisfied, all is fine, and process goes on; when the condition is not satisfied, then an error is triggered: the message of the error is the second argument.

The post then gets into more detail about the assertions, noting that the result has to be positive and that they can be somewhat configured (basically turned on/off and the error level can be adjusted). It also covers some examples of things to test with assertions, how they should be treated as debugging and to avoid using them on resources outside the code (like database connections).

tagged: assertion usage language native tutorial introduction

Link: https://www.exakat.io/php-assertions-usage/

Freek Van der Herten:
Handling CORS in a Laravel application
Jan 08, 2018 @ 09:47:07

On his blog today Freek Van der Herten has a post introducing a new Laravel package designed to help make CORS implementation simpler in your application. CORS headers are, essentially, what allows clients (like browsers) to talk across domains in a configurable and enforceable fashion.

Recently we released laravel-cors. This package can add the necessary CORS headers of your Laravel app. In this post I'd like to give a quick explanation of what CORS is and how you can use the package.

The post starts by explaining a bit about CORS (Cross-Origin Resource Sharing) headers, what they're used for and simple examples of when they might be most useful. It then covers the package, showing how to pull it into your packages and adding it to the middleware configuration for loading on each request. There's also a more detailed configuration you can use to defined allowed and denied domains as well as the idea of "profiles" for different user levels.

tagged: cors laravel crossorigin resource header package introduction tutorial

Link: https://murze.be/handling-cors-in-a-laravel-application

Fabien Potencier:
Symfony 4: Unpack the Packs
Jan 04, 2018 @ 11:53:47

Fabien Potencier of the Symfony project has a post on his site that introduces Symfony Packs, groupings of useful packages that can enhance the functionality of your application without having to manually load each package individually.

We get a lot of positive feedback on Symfony 4. You love the new directory structure. You love the simplicity of using services without configuring anything. And you love the automation that Flex provides. It makes me happy and proud.

[...] But one issue I hear sometimes is that it is more complex to start a new project. [...] You loved the simplicity of starting a project with the Symfony Standard Edition. Is it nostalgia? Perhaps. Would it be possible to get the best of both world? Certainly!

The Packs are "metapackages" that Composer uses to bundle dependencies together that relate either in functionality or as defined by a custom configuration. The article gives an example using the symfony/orm-pack pack and talks about how you can use it as-is or you can "unpack" it into its separate packages and automatically update the composer.json with the result.

tagged: symfony symfony4 pack composer metapackage introduction

Link: http://fabien.potencier.org/symfony4-unpack-the-packs.html

Laravel News:
Building a Vue SPA with Laravel
Jan 04, 2018 @ 10:23:08

On the Laravel News site there's a new tutorial posted showing you how to create a Vue.js single page application with Laravel for when you have API-driven applications.

Building a Vue single page application (SPA) with Laravel is a beautiful combination for building clean API-driven applications. In this tutorial, we show you how to get up and running with Vue router and a Laravel backend for building a SPA. We will focus on the wiring up all the pieces needed, and then in a follow-up tutorial, we will further demonstrate using Laravel as the API layer.

They walk you through the creation of a simple SPA that will render the initial content and allow for the browsing back and forth between content without a page reload. The tutorial helps you get all required libraries installed and includes the code to define the Vue router and two routes. The contents of the .vue files are also included as well as the server-side code to power the application.

tagged: laravel vuejs tutorial singlepage application spa introduction

Link: https://laravel-news.com/using-vue-router-laravel