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

Christopher Pitt:
Building a blog - Introduction & Posts
Oct 29, 2018 @ 17:56:15

Christopher Pitt has kicked off a new series of posts to his site covering the creation of a new blog system. It's not just any blogging system, however. In this system he's developing it as an asynchronous application using preprocessing. In the introduction to the project he fills in more of the details:

I’ve been building this blog, for a few days now, and it’s been a fun experience. This is partly because it’s an asynchronous application, and partly because it uses a lot of preprocessing.

I thought it would be interesting for me to describe how it is put together, in an ad-hoc sort of series. In the series, I’ll show bits of code and links to libraries I’ve used. I’ll talk about why I’ve chosen to do things in certain ways, and what I could improve (short of deleting everything and starting over with a mature framework).

In this first part of the series, he includes a "tiny bit of code" showing a component of the system before the preprocessing has been run. He's also posted the second part of the series that continues covering the functionality for handling "posts" in more depth (including the use of flat files for content storage and functionality to output Markdown content as HTML).

tagged: tutorial series part1 part2 blog introduction asynchronous preprocessing

Link: https://assertchris.io/post/2018-10-24-building-something-new

Laravel News:
Building and Maintaining a Laravel Translation Package
Oct 22, 2018 @ 16:28:08

The Laravel News site has kicked off a series of posts sharing some of the experiences from Joe Dixon about the creation and maintenance of a Laravel translation package.

In this multi-part series, we’ll be documenting the process of building and maintaining an open-source package for Laravel. We will cover everything from bootstrapping the package to dealing with your first issues and pull requests and as much as we possibly can in between.

In this first part of the series he goes over some of the basics:

  • why they're building the tool
  • what they're planning on creating
  • how they're expecting it to be used

There's a bit of background about the tools they're planning on using and pseudo-code of how it will work.

tagged: laravel translation package series part1

Link: https://laravel-news.com/building-laravel-translation-package

Matt Glaman:
Running Drupal's PHPUnit test suites on DDEV
Oct 15, 2018 @ 14:36:29

Matt Glaman has a new post to his site where he walks you through the setup and execution of Drupal's unit tests in the DDEV platform (a Docker-based project that makes it easy to get an environment up quickly).

DDEV is a local development stack built on top of Docker. It gives you all of your environment needs without messy configured on your host machine, without needing to know Docker or configure your own containers. Which is great, and makes life easier. Instead of just using DDEV to develop your site or application locally, why not also run your tests within it?

I have had quite a few people ask me how I configure my setup for testing with Drupal’s PHPUnit test suites. [...] All of these are the same reasons for using a virtual machine or containerized local development stack. So, it is fitting we run our tests within these local stacks as well!

In this article, part one of three, he assumes you already have a DDEV environment up and running with a Drupal application running inside (there's a guide here). With that in place, he shows how to configure PHPUnit via the phpunit.xml file, changing the "SIMPLETEST_*" values for the localhost and local DB connections. He shows how to run the tests by SSHing into the web Docker container and pointing PHPUnit at the configuration file. The end result should look something like this in a terminal.

tagged: tutorial series part1 drupal test unittest ddev docker testsuite

Link: https://glamanate.com/blog/running-drupals-phpunit-test-suites-ddev

Alex Makdessi:
Diving into Symfony's DependencyInjection - Part 1: First steps with the container
Oct 10, 2018 @ 16:53:34

Alex Makdessi has a post on his Medium.com site kicking off a series of posts taking a deeper look into the Symfony DependencyInjection component. In this first part of the series he takes some of the "first steps" with the container.

this article, we’re going to dive into Symfony’s dependency injection component. We will use it from scratch, out of the Symfony framework, with the minimum of external dependencies. You can code along with me while reading this article, each steps will be detailed so you can easily follow.

He starts off the tutorial by creating a new project and including the DependencyInjection (DI) component via Composer (as well as symfony/var-dumper for debugging). He then starts in on the code showing how to make a ContainerBuilder instance to hold the object instance for reuse. With the container created, we now need something to use it. He creates a basic piece of functionality that works similar to the "voters" included with Symfony's security component to determine if a user has a certain role. He first creates this as a stand-alone tool but then refactors it so that the access manager and post voter objects are pulled from the dependency injection container rather than made manually.

tagged: symfony depdendencyinjection part1 series firststeps voter tutorial

Link: https://medium.com/manomano-tech/diving-into-symfonys-dependencyinjection-part-1-first-steps-with-the-container-2fad0593c052

Matthias Noback:
Test-driving repository classes - Part 1: Queries
Sep 25, 2018 @ 15:28:31

Matthias Noback has kicked off a new series of posts on his site covering the use of the repository design pattern in different situations. In this first post he focuses on "test driving" classes for handing database queries and their results.

A test for a repository can't be a unit test; that wouldn't make sense. You'd leave a lot of assumptions untested. So, no mocking is allowed.

[...] But how do you test everything that is going on in a repository? Well, I found out a nice way of doing so, one that even allows you to use some kind of test-driven approach. In this article I'll cover one of the two main use cases for repositories: querying the database, and returning some objects for it. The other use case - storing and loading objects - will be discussed in another article.

He starts by getting everyone on the same page with a definition of a "query" and how it relates back to a repository class. He then walks through the process of how to test the class, first as a general "get all" query then with a check on the "active" state. Once the test goes green (successful), he adds more variations to both the tests and fixtures. There's not a lot of code examples in this post but it does show some good concepts to get you headed down the right path.

tagged: tutorial repository designpattern query database part1 series

Link: https://matthiasnoback.nl/2018/09/test-driving-repository-classes-part-1-queries/

SitePoint PHP Blog:
Building an Image Gallery Blog with Symfony Flex (Parts 1 & 2)
Jun 21, 2018 @ 16:48:56

On the SitePoint PHP blog they've kicked off a series by Zoran Antolovic walking through the creation of a blog application using the latest from the Symfony project - Symfony Flex.

Our journey towards a stable, robust, high-performance web app will start with the simple but functional application — the so-called minimum viable product (MVP). We’ll populate the database with random content, do some benchmarks and improve performance incrementally. Every article in this series will be a checkpoint on our journey!

This article will cover the basics of setting up the project and organizing files for our Symfony Flex project. I’ll also show you some tips, tricks and helper scripts I’m using for speeding up the development.

So far they've posted the first two articles of the series:

  • Part one explaining some of the basics of Flex and getting the application set up (including some sample fixture data)
  • Part two showing how to populate the application with more realistic data, run some basic performance tests and create a first unit test

There's much more to come in the series including the creation of file (image) upload handling, user registration and login and the creation of image galleries from uploads.

tagged: image gallery blog tutorial symfonyflex symfony flex part1 part2

Link: https://www.sitepoint.com/building-image-gallery-blog-symfony-flex-setup/

Symfony Blog:
New in Symfony 4.1: Misc. improvements (Parts 1-4)
May 30, 2018 @ 18:18:05

On the Symfony project blog they've posted a series of articles covering some miscellaneous improvements made for the v4.1 release of the framework.

During the past months we've published almost 40 blog posts about the main new features of Symfony 4.1. In this article you'll find some of the other small but nice new features.

Here's the list of the posts and some of the things covered in each:

  • Part 1: CSRF without forms, visibility change in progress bar component, showing dotenv files in the profiler
  • Part 2: command to delete cache pool items, allowing custom functions in "allow_if" expressions, addition of "dd" debug helper
  • Part 3: add/remove LDAP attributes efficiently, keeping the query string after redirect, hasser accessors in PropertyInfo
  • Part 4: adding anonymous services in PHP DSL, support for extracting type from constructor, configurable PHP error log level

Check out each post for a brief summary of each change and example code/configuration showing how to make use of it.

tagged: symfony improvement v41 series part1 part2 part3 part4

Link: https://symfony.com/blog/new-in-symfony-4-1-misc-improvements-part-1

Matt Sparks:
Building a PHP Framework Series (Parts 1-4)
May 16, 2018 @ 17:50:42

On this site Matt Sparks has posted the first few parts of a series covering the creation of a custom framework. Why? Well, as he explains in part one of the series:

So with all of that being said, it begs the question: why on Earth would you want to do this?

The extremely short answer: I want to. The less short answer: A PHP framework encompasses many of the areas I want to learn more about.

The first four posts of the series are already on his site (with more to come):

Matt does a great job of laying out some of the fundamentals behind frameworks including structure, design patterns, and commonalities between frameworks. You can follow along with his progress on the project on the AnalyzePHP GitHub repositories.

tagged: build framework tutorial series part1 part2 part3 part4

Link: https://developmentmatt.com/building-a-php-framework-part-4-the-foundation/

Delicious Brains:
WordPress Deployment Part 1: Preparing WordPress
May 09, 2018 @ 16:05:12

The Delicious Brains blog has kicked off a new series of posts walking you through the deployment of a WordPress site with automated (and repeatable) deployments.

Welcome to the first post in a workflow series on deploying WordPress. In this series, we’re going to look at how you can set up automated deployments for your WordPress site in a range of different ways.

They start off by answering the question of "why" for automated deployments. They make the point that automated deployments can help reduce the potential for human error, increase the reliability of the deployments and have many more benefits. Next they start in on the preparation work, helping you get several prerequisites set up before getting to the deployment process:

  • Setting up the site on an accessible Git repository and having plugins/dependencies managed by Composer
  • Deploying configuration files
  • Disable FTP Access & File Editing
  • Disable Auto Updates

The post also includes a section covering the deployment of the database for your application and any other media you might have related to it (images, files, etc).

tagged: wordpress deployment series part1 preparation

Link: https://deliciousbrains.com/wordpress-deployment-workflow-preparing/

Christoph Rumpel:
Build a newsletter chatbot in PHP (Part 1 & 2)
Mar 02, 2018 @ 15:56:21

On his site has posted parts one and two of a series showing how to build a chatbot that can help provide more direct interaction with your users via a "newsletter" feature.

Since the beginning of the year, I am working on a new project of mine. It's a book called Build Chatbots with PHP. Follow the link to find out what it is about and who it is for.

More interesting to us is the newsletter, to which you can subscribe on the book's website. About once or twice a month I will send out an email with news on the development of the book.

He starts part one by outlining the general plan and functionality for the bot and its integration with Facebook. The tutorial then walks through the installation and configuration of the BotMan Studio project. It also shows the setup of the application on the Facebook service and how to connect it to the BotMan application. He walks through the setup of a few commands to welcome the user and start the conversation. Part two continues the process showing how to store the user and subscription information and how to send the newsletter notifications. He also makes some suggestions of extra functionality you might want to add like a typing indicator, a "fallback" for unknown commands.

tagged: introduction part2 part1 series tutorial chatbot newsletter facebook

Link: https://christoph-rumpel.com/2018/02/build-a-newsletter-chatbot-in-php-part-1


Trending Topics: