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

Sameer Nyaupane:
PHP Test Driven Development Part 5: Integration Testing
Nov 15, 2018 @ 13:54:21

Sameer Nyaupane has posted the latest part in his "PHP Test Driven Development" series of tutorials. In this latest post, part five, he focuses on integration testing, ensuring the components are all working together as they should.

Let’s learn about Integration testing today. Integration testing is a method of testing by passing in the real dependencies and thus testing out the integration between two or more objects.

He updates the examples from his previous post to test the integration between the Math and Calculate classes. He walks you through the changes required to the phpunit.xml configuration and the creation of the initial test classes. He goes through each line of the tests, explaining what it's doing and how mocks are used to help with dependencies.

tagged: tutorial testdrivendevelopment tdd part5 series integration testing

Link: https://medium.com/@sameernyaupane/php-test-driven-development-part-5-integration-testing-51535ca56bf0

CodeWall:
Install Summernote With Laravel Tutorial
Oct 30, 2018 @ 10:33:21

On the CodeWall site they've posted a new tutorial showing you how to integrate the Summernote WYSIWYG editor into your Laravel application for easier content creation. Summernote is one of many potential WYSIWYG editors that will work easily with Laravel.

What You See Is What You Get (WYSIWYG), is mostly used by the developers for describing a software program which they use for checking visibility of the final product. A user friendly interface is required to run WYSIWYG program. While to write descriptive codes, a developer could use WYSIWYG editor which helps them to see the content that will appear as the end result.

[...] Well users of Laravel have good news, it supports multiple WYSIWYG editors. Therefore, if you are a developer and like developing applications with this brilliant framework, you’re in luck. In this article, I will elaborate about the best WYSIWYG editors you can use working with Laravel. With a plethora of WYSIWYG editors available, it’s quite hard to decide which one best suits your needs. Well, you don’t have to worry a bit. I will provide a detailed account on some of the best Laravel WYSIWYG editors in this article. With these editors, you can easily develop your content and codes. I will also highlight the pros and cons of WYSIWYG editors.

They made the choice to go with Summernote and walk you through the integration process including:

  • a listing of some of the prerequisites
  • configuring the database and making migrations for the content
  • building out the routes, models, views, and controllers

They also show how to add the Summernote instance to a view and configure it to your liking.

tagged: summernote tutorial laravel application integration

Link: https://www.codewall.co.uk/install-summernote-with-laravel-tutorial/

Frederick Vanbrabant:
The Integration Operation Segregation Principle
Oct 15, 2018 @ 10:48:13

In a new post to his site Frederick Vanbrabant tackles the integration operation segregation principle. While the term sounds intimidating, it's just a long way to say something you probably already do: refactor code into smaller testable chunks.

A few weeks ago I attended a DDDBelgium meetup where I was lucky to participate in a refactor workshop lead by Pim and Joop. After the incredible workshop Pim, Dries and me were discussing some code that we refactored earlier . Not so long in the conversation the words “Integration Operation Segregation Principle” casually got dropped by Pim.

Now I’m going, to be honest with you (as I was with them), I had no idea what the hell he was talking about. And maybe neither do you.

He starts with some simple code for a "calculator" class with a calculate method to handle the pricing of a rental car. He includes the test for the class/method as well, using a mock object and several expects calls to handle the method calls. The test ends up being larger than is probably good, so he looks into refactoring the original code to abstract out some of the functionality and make it more testable. In the process this also makes the code easier to follow and, while there is more of it, more maintainable and flexible in the end.

tagged: tutorial integration operation segregation principle refactor testable unittest

Link: https://frederickvanbrabant.com/post/2018-10-08-integration-operation-segregation-principle/

Freek Van der Herten:
Introducing BladeX View Models
Oct 05, 2018 @ 09:38:54

In a new post to his site Freek Van der Herten announces the release of their latest package to help with the integration of the BladeX functionality into your Laravel views - using them with view models.

Earlier today we released BladeX, a package that allows you to use Blade components using a Vue inspired syntax.

[...] In the latest North Meets South podcast Jacob and Michael discussed BladeX and wondered if the package could be married with view models or Laravel's View Composers. Our team discussed this too last Friday but we decided to release the core features of BladeX first. After the release today it became apparent pretty fast that we needed some sort of view model support in our projects too. So we got to work!

He then walks you through how to integrate the two pieces of functionality to render a select element containing a country list. He includes the backend code to make the connection between BladeX and the model as well as the view model and template code. He finishes the post with an example of what the result should look like, containing the three countries from his list.

tagged: bladex component viewmodel tutorial integration

Link: https://murze.be/introducing-bladex-view-models

Paul Jones:
Atlas ORM Integration with Symfony
Jul 31, 2018 @ 12:16:26

Paul Jones has a quick post covering the use of his Atlas.Orm package in a Symfony application, showing how to easily integrate the two.

Are you using Symfony 4? Do you want to use Atlas with it? We now have a Symfony bundle and Flex recipe that makes installation and integration a breeze. Two commands and one .env file edit, and you’re ready to go.

He includes the commands you'll need to get it installed and generate the skeleton mapper files from your database. Symfony then automatically injects the Atlas instance from the container (code example included). He ends the post linking to other resources about defining relationships, managing transactions and handling events with the Atlas.Orm package.

tagged: atlasorm integration symfony flex bundle package tutorial

Link: http://paul-m-jones.com/archives/6916

Zend Framework Blog:
Zend Framework/Homestead Integration
May 18, 2018 @ 12:48:26

On the Zend Framework blog, project lead Matthew Weier O'Phinney has posted a tutorial showing you how to set up a Homestead instance for Zend Framework thanks to a few helpful submissions from the ZF project.

Last year, we tagged: zendframework homestead integration tutorial laravel apigility zendexpressive

Link: https://framework.zend.com/blog/2018-05-16-homestead.html

Sergey Zhuk:
Amp Promises: From Generators To Coroutines
Feb 15, 2018 @ 09:27:05

In a new post to his site Sergey Zhuk takes a look at generators in PHP and shows how they're integrated into coroutines and promises to help with the chunked asynchronous processing.

Generators become available in PHP since version 5.5.0. The main idea is to provide a simple way to create iterators but without creating a class that implements Iterator interface. A generator function looks like a normal function, except that instead of returning the result once, a generator can yield as many times as it needs to in order to provide the values to be iterated over.

[...] So, let’s wrap up what we know about generators:

  • interruptible/resumable functions
  • use yield rather than (or in addition to) return
  • values/exceptions can be send/thrown into
  • behave like iterator

All these generator features are used in <a href="https://amphp.org/>Amp to implement coroutines.

The post starts out with a pretty detailed look at generators in PHP and the functionality they offer. It covers sending values into the generator, exception handling and the use of the yield statement. It then moves over to describing coroutines, promises and deferred handling. Generators make it easier for them to chunk up the operation one piece at a time rather than requiring all data up front.

tagged: amp promise coroutine generator tutorial integration

Link: http://sergeyzhuk.me/2018/02/15/amp-coroutines/

Laravel News:
Sending and receiving SMS Laravel Notifications with Nexmo
Jan 11, 2018 @ 10:52:01

The Laravel News site has published a tutorial for those Laravel users out there that would like to integrate their application with Nexmo for the sending and receiving (and handling) of SMS messages in your application.

This is the first part of a series of tutorials by Michael Heap, covering how to build a multi-channel help desk system with Laravel. In this post, we’ll take a basic web based help desk system and extend it to send and receive SMS messages using the built-in Laravel notification system (which is powered by Nexmo).

The tutorial starts with some of the prerequisites you'll need to get started including a Nexmo account and the ngrok tool for exposing your site publicly while still hosting it locally. It then starts in on the functionality, using the Deskmo repository as a starting place. After a few setup steps the article has you hop over to Nexmo and purchase a number to use for the SMS and configure the application to use this number. Next it shows how to send a sample message when a ticket is created and how to receive an incoming SMS message to pull in the information and create a new ticket.

tagged: sms nexmo integration laravel helpdesk tutorial ngrok

Link: https://laravel-news.com/nexmo-sms-laravel-notifications

Sergey Zhuk:
Test Coverage: Integration Between CodeClimate and Travis CI
Jan 11, 2018 @ 09:42:11

In a post to his site Sergey Zhuk shows you how to get up and running on Travis-CI and Code Climate for generation unit test coverage with an integration between the two services.

When you maintain an open-source project it is considered a good practice to have a high test coverage, so the community can feel safe about using your code in their projects. There are some services that can analyze your code quality and provide some feedback about it. One of the most popular is Code Climate. This service doesn’t run your tests, but you can use one of CI tools to run them and then send their result to Code Climate. This article will show how to use Travis CI to run your tests and CodeClimate to get your test coverage.

The rest of the tutorial is broken down into five steps (well, five-ish - some have sub-steps):

  • Get Your CodeClimate Reporter ID
  • Add Your Code Climate Token To Travis CI
  • Add CodeClimate Test Reporter Package
  • Update phpunit.xml
  • Update Travis CI Config To Send A Report

Each section includes the configuration changes to the .travis.yml or phpunit.xml configuration files you'll need to make to connect the services and generate the reports automatically.

tagged: unittest coverage metric travisci codecliemate integration automatic tutorial

Link: http://sergeyzhuk.me/2018/01/11/travis-with-codeclimate/

Delicious Brains Blog:
Using VS Code for WordPress Development
Dec 05, 2017 @ 10:15:42

On the Delicious Brains site there's a tutorial that shows you how to use Microsoft's VS Code IDE for PHP development. They focus more specifically on WordPress development but a lot of the environment setup could be used for any PHP project.

If you keep up with the many different text editors and developer tools available, you may have heard of a newer IDE called Visual Studio Code. VS Code is a free, open source code editor that is lightweight like Sublime Text, but offers many of the same features as bigger IDEs like PhpStorm or WebStorm.

In this article I’ll review some features and extensions of VS Code that I really appreciate, and show you how to make the most out of it for WordPress and general web development.

The tutorial walks you through the installation and integration of various PHP development tools including an "intellisense" extension, XDebug support, a Javascript debugger and a few other helpful extensions. Install instructions are included as well as screenshots/screencasts showing the end result.

tagged: visualstudiocode vscode ide introduction installation setup debug integration wordpress

Link: https://deliciousbrains.com/vs-code-wordpress/