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

Joe Ferguson:
Adding MySQL 8 support to Laravel Homestead
Nov 07, 2018 @ 18:57:21

In a new post to his site Joe Ferguson has included a screencast showing how to add MySQL 8 support to Laravel Homestead for your local development.

My friend Beau Simensen has been doing awesome stuff building and streaming his work on astrocasts.com. He’s inspired me to start streaming again and last night I spent some time adding a feature to Laravel Homestead to add MySQL 8 as an option.

In the video Joe walks through the whole process including how Homestead is set up (via Vagrant) and all of the configuration changes you'll need to make to get MySQL 8 support up and running. The video runs about an hour and a half but it's a great resource if you're looking to use this latest version of MySQL in your application.

tagged: screencast mysql8 mysql support homestead tutorial

Link: https://www.joeferguson.me/adding-mysql-8-support-to-laravel-homestead/

Laravel News:
Learn how to set up Xdebug for PhpStorm and Laravel Valet
Aug 10, 2017 @ 17:48:41

On the Laravel News site there's a post sharing a guide (and a screencast) that helps you set up XDebug and Laravel Valet to work with PHPStorm for debugging your code.

I’ve been developing web applications for about 15 years, but somehow Xdebug is still challenging to set up. Follow along and learn how to find Xdebug settings and configure it for local development with PhpStorm.

If you are using PHP-FPM locally, you might have run into an annoying issue that no matter what you do Xdebug won’t work! I might have an answer for you in this video.

The video, viewable either in-page or on YouTube directly. It's about 15 minutes long and provides you with the prerequisites, commands to get everything set up and the configuration changes to make to the PHP config and PHPStorm to get them working together.

tagged: laravel valet xdebug tutorial screencast tutorial

Link: https://laravel-news.com/xdebug-phpstorm-valet

Fabien Potencier:
Symfony 4: A quick Demo
May 05, 2017 @ 14:39:52

Fabien Potencier has continued his post series covering the next major release of the Symfony framework, Symfony 4. In this latest post he walks you through a quick demonstration of the creation of a new Symfony 4 application including a simple administration system.

Time to test Symfony 4... or at least let's test the experience of developing Symfony 4 projects with Symfony 3.3. Keep in mind that all the tools are in preview mode. Features might evolve over time. I'm waiting for your feedback! The first stable version of Symfony Flex will not be released before Symfony 4 at the end of November 2017. It gives the community plenty of time to discuss the changes I have described in this series of blog posts.

He then walks through the process for creating the application:

  • Using Composer's "create-project" to make a new skeleton application
  • Setting it up as a git repository
  • Defining environment variables
  • Registering the framework bundle
  • Installing the command line tools

With the basic application set up he then shows how to install the EasyAdminBundle to create the simple administrative interface. He's also created a screencast showing this same process so you can see it all in action.

tagged: symfony4 demo screencast skeleton application bundle install

Link: http://fabien.potencier.org/symfony4-demo.html

Adam Wathan:
Detecting Out of Sync Mocks in Mockery
Apr 05, 2017 @ 16:14:41

Adam Wathan has shared a new post on his site with advice on finding out-of-date mocks when using the Mockery mocking tool in your testing.

If you're not careful, it's easy to find yourself in a situation where a test double has gotten out of sync with the actual class or interface it's mocking.

In this quick screencast (taken from my Test-Driven Laravel course), I walk through how I use a little-known Mockery feature to help track down these issues and make sure I'm not mocking methods that don't exist.

The quick screencast (about 4 minutes) gives an example of locating the issue when a "Ticket" class is refactored. While the tests still pass, it can cause issues in testing and can be difficult to find. Mockery comes with a configuration option (in 1.0 alpha) to disable the mocking of methods that don't exist on the original object. He shows how to disable this feature and what the resulting error looks like when the tests are run.

tagged: mockery screencast unittest mock sync class disable configuration

Link: https://adamwathan.me/2017/04/03/detecting-out-of-sync-mocks-in-mockery/

Master Zend Framework:
How To Generate Class Factories The Easy Way with FactoryCreator
Jan 20, 2017 @ 16:07:57

The Master Zend Framework site has a new tutorial posted guiding you through the process of generating class factories the easy way with the help of the "FactoryCreator" tool in the Zend ServiceManager component.

If there’s one thing that’s always frustrated me when working with Zend Framework, it’s having to create factories for classes. Sure, it’s gotten easier as Zend ServiceManager’s continued to ever improve. And PhpStorm and Zend ServiceManager Grand Master, Gary Hockin, has given me a number of great tips and suggestions.

But it’s always been something I’ve felt frustrated by. Perhaps you feel the same. [...] But, what I’ve felt for some time is that they could also make it easier for us to follow these best practices too, such as with some tooling support. In the latest release of Zend ServiceManager, version 3.2.0, they have.

He goes on to talk about two tools that are included in this latest release: the ConfigDumper and FactoryCreator. He helps you get the FactoryCreator tool installed and provides a simple example of it in use, generating the factory for a "JournalService" class. He includes the results of the generation of the simple example before moving on to a more complicated example: a TableGateway object. The final example shows the generation of the factory for an "Actions" class, handling the controller processing for a simple MVC application. If you're a bit shorter on time, he's also created a screencast version of the tutorial you can view in-page or over on Vimeo.

tagged: zendframework generate class factory factorycreator tutorial screencast

Link: http://www.masterzendframework.com/simple-factory-generation-with-factorycreator/

SitePoint PHP Blog:
Interrupting Applications with Laravel Middleware
Nov 16, 2016 @ 18:13:05

The SitePoint PHP blog has a new tutorial posted showing you how to "interrupt applications with Laravel middleware", adding functionality to your request/response handling in a more automatic and reusable way.

Before we launch into using middleware with Laravel, what is middleware? In general, middleware is software that connects different systems to one another. In Laravel, it’s one of the most well known and robust PHP frameworks that are available for use today, middleware provides a way for you to filter out your HTTP requests and manage those requests. This allows you to dictate how those requests interact with your application.

The use of middleware in Laravel 5 can interrupt requests to your application. [...] Laravel’s middleware can interrupt those requests and then perform various actions such as controlling access and requiring authentication to enter certain areas.

They get into some of the details about middleware, how it "interrupts" your requests and then relate it back to its use in Laravel applications. The tutorial talks about using the "artisan" command line tool to make the middleware and an embedded video from their own Laravel series giving even more detail.

tagged: laravel middleware interrupt framework tutorial screencast

Link: https://www.sitepoint.com/middleware-in-laravel-5/

TutsPlus.com:
How to Secure a REST API With Lumen
Oct 26, 2016 @ 15:56:58

Over on the TutsPlus.com site there's a new tutorial posted for the Lumen users out there building REST APIs. The post walks you through an authentication method for the API making use of Laravel's included "guard" handling and an API token.

Lumen is Laravel's little brother: a fast, lightweight micro-framework for writing RESTful APIs. With just a little bit of code, you can use Lumen to build a secure and extremely fast RESTful API.

In this video tutorial from my course, Create a REST API With Lumen, you'll learn how to use Lumen's built-in authentication middleware to secure a REST API with Lumen.

The post includes the screencast of the tutorial but it also includes all of the content below that in more developer-friendly text form. Screenshots of the code in various states are also included as well as descriptions of what's happening in the auth process along the way.

tagged: lumen security rest api screencast tutorial

Link: https://code.tutsplus.com/tutorials/how-to-secure-a-rest-api-with-lumen--cms-27442

Master Zend Framework:
How To Simplify Zend Expressive Configuration with ConfigProviders
Aug 15, 2016 @ 17:42:19

The Master Zend Framework site has a new tutorial posted helping you simplify the configuration on your Zend Expressive application with the help of ConfigProviders, a handy feature that lets you split up the configuration into logical "chunks" as PHP classes.

Given Zend Framework’s design (and accompanying flexible nature), this [configuration complexity] can easily be the case if we’re not careful. [...] Specifically, we’ll likely end up with a config/autoload directory polluted with a plethora of configuration, including for dependencies, routing, and middleware.

[...] As it turns out, this was something which was already identified by other developers, including the Zend Framework contributors. [...] In there, he mentioned ConfigProvider classes as a simple way of enabling ZendForm ViewHelpers, which aren’t enabled by default in Zend Expressive. As I looked at the composition of the file, I realized that this was the answer I needed to solve the configuration issue I created for myself.

A screencast is included in the post showing off the solution but the code an explanation are below that as well for those more interested in reading than watching a video. He walks you through the creation of the configuration provider including setting up the dependency configuration, updating the route handling and, finally, actually using the provider in your global configuration.

tagged: zendexpressive configuration provider configprovider tutorial screencast example

Link: http://www.masterzendframework.com/configproviders-classes/

ShippingDocker.com:
Testing in Docker (Using Different PHP Versions)
Aug 12, 2016 @ 17:23:58

On the ShippingDocker.com site there's a video (and matching tutorial) posted showing you how to use Docker to test with multiple PHP versions with relatively little difficulty. In this case they're not testing the frontend of the application, they're running its unit tests.

[This is a] quick video on running PHP unit tests against different versions of PHP using Docker. [We'll] cover unit testing with PHP.

They start with an example of using the pywatch tool to do the testing without Docker, automatically executing the tests when something changes. This has the limitation of only being able to use your current, local version of PHP. They then shift over to the Docker side of things and show how to run the same pywatch command inside a container of your choosing, tagging it with the PHP version and making it easy to switch between them in the future.

tagged: docker version unittest different example video screencast tutorial

Link: https://shippingdocker.com/blog/docker-testing/

Adam Wathan:
Stubbing Eloquent Relations for Faster Tests
Aug 08, 2016 @ 16:52:53

Adam Wathan has a recent post to his site showing you how to stub out your Eloquent relations in a Laravel application for use in your testing (rather than hitting the database directly).

When you’re trying to test methods on an Eloquent model, you often need to hit the database to really test your code.

But sometimes the functionality you’re testing doesn’t really depend on database features. Is there any way to test that stuff without hitting the database?

He starts with a look at the more traditional method, using the models normally and testing with the database. He includes a simple test and class showing a basic "song duration" integer response. He gets into a bit more detail on how the Eloquent code grabs the data it needs when a relation is accessed (hint: not a separate query) and how to update the test to mimic the eager loading of the duration information. He ends the post by pointing out that "nothing is free" however as, if the underlying database implementation changes, the test would start to fail regardless of it not using the database.

tagged: tutorial screencast example relation eloquent unittest stub

Link: https://adamwathan.me/2016/08/04/stubbing-eloquent-relations-for-faster-tests/


Trending Topics: