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

Oh Dear Blog:
Our Gitlab CI pipeline for Laravel applications
Dec 18, 2018 @ 17:14:53

On the "Oh Dear!" blog they've written up a post sharing the Gitlab continuous integration pipeline they use for the deployment of the application. While, in their case, it's a Laravel-based application, the basics of it could be used for just about any PHP application with slight modifications.

We've been fairly public about the amount of testing we have for Oh Dear!. Freek has been showing bits and pieces on his Twitter to show the extent of that effort.

Having a huge test suite is nice, but integrating it into your development workflow is even better.

That's why we're releasing our Gitlab CI pipeline that is optimized for Laravel applications. It contains all the elements you'd expect: building (composer, yarn & webpack), database seeding, PHPUnit & copy/paste (mess) detectors & some basic security auditing of our 3rd party dependencies.

The post starts with an overview of their pipeline flow (including a graphic) showing the different stages and the steps involved in each. It then moves on to the setup of Gitlab's CI functionality using a local Gitlab runner to run the pipeline. It covers some of the issues around CPU load using Docker. Next it shares the configurations for the different stages in the flow and decisions they had to make around building assets, dependencies and caching.

tagged: tutorial laravel application gitlab gitlabci continuous integration setup pipeline

Link: https://ohdear.app/blog/our-gitlab-ci-pipeline-for-laravel-applications

Sameer Nyaupane:
PHP Test Driven Development Part 5: Integration Testing
Nov 15, 2018 @ 19: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 @ 15: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 @ 15: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 @ 14: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 @ 17: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 @ 17: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 @ 15: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 @ 16: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 @ 15: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/


Trending Topics: