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

TutsPlus.com:
Render Text and Shapes on Images in PHP
Sep 25, 2018 @ 17:36:25

TutsPlus.com has continued their series of posts covering the use of image manipulation functionality in PHP using the GD library. In this latest tutorial they cover drawing shapes in images and rendering fonts.

Besides using GD for manipulating regular images, we can also create our own from scratch. Different functions in the library can be used to draw basic shapes like ellipses, circles, rectangles, polygons, and simple lines. With some maths, these shapes can create nice patterns. There are also functions available to draw text on the rendered image, which opens up a lot of possibilities.

This tutorial will teach you how to draw basic shapes in PHP and how to render text using your favorite font.

The tutorial starts by explaining what functions to use to draw lines, circles, arcs, rectangles, and polygons. Example code is provided showing all of these in action together to create a basic line drawing of a house and sun. They then enhance this with changes of line thickness, color fills and the use of a "brush" created from another image to make a new house picture. The tutorial finishes with a look at how to integrate fonts into the image and insert whatever text you might want (using a true-type font).

tagged: tutorial series image manipulation part3 text shapes

Link: https://code.tutsplus.com/tutorials/rendering-text-and-basic-shapes-using-gd--cms-31767

php[architect]:
Pro Parsing Techniques With PHP, Part Three Using Regular Expressions
Aug 29, 2018 @ 15:55:15

On the php[architect] site they've posted the latest part of their series of magazine excerpts sharing methods for parsing text with PHP. In this third (and last) part the author focuses on the use of regular expressions. This article was originally printed in the magazine's August 2018 edition.

This is the final installment of a set of three articles offering strategies for parsing text with PHP. The first article described the basics of parsing, followed by an article on developing fault tolerant parsing strategies. This article is dedicated to regular expressions.

Regular expressions, or sometimes simply called regex, represent a powerful set of tools which allow developers to split strings, perform character substitutions, and extract text based on matched patterns. The patterns, used in regular expressions, are an actual language that describe combinations of type castings and values that match the text you want to split, substitute, or extract. Regular expressions are an enormously powerful tool for the developer who understands them.

The tutorial starts by walking through some of the basics of what regular expressions are and the functions provided by PHP (using preg_*) to work with them (including basic code examples). It then briefly talks about pattern matching with regular expressions and gives a more specific example showing phone number extraction.

tagged: phparchitect august18 parsing text series part3 regularexpression tutorial

Link: https://www.phparch.com/2018/08/pro-parsing-techniques-with-php-part-three-using-regular-expressions/

Delicious Brains:
WordPress Deployment Part 3: Deploying WordPress Using Git
Aug 14, 2018 @ 14:37:04

The Delicious Brains site has continued their series covering WordPress deployment with part three: Deploying WordPress Using Git. While their instructions relate to WordPress, the examples given would work for any PHP-based application.

In my last article, we looked at deploying WordPress using some different command line (CLI) tools. In this article, we’re going to look at how we can deploy WordPress using Git, both manually via the CLI and also automatically when you push code to your remote repository.

They start by listing out the tooling you'll need to follow along - Git and Composer - and an example repository you can work from. The post then walk through three different methods you can use to deploy making use of Git:

  • a "git pull" on the production server
  • automated deployment via webhooks
  • deployment using a continuous integration service

For each item there's a brief summary included as well as configurations, screenshots and setup instructions.

tagged: wordpress deployment series part3 git composer tutorial

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

Sergey Zhuk:
Fast Web Scraping With ReactPHP. Part 3: Using Proxy
Jun 26, 2018 @ 17:27:43

Sergey Zhuk has posted the third part of his series covering the use of ReactPHP to scrape content from another source on the web. In this third part of the series he improves on his scripts from before (scraping from the IMDB site) to add in a proxy server.

n the previous article, we have created a scraper to parse movies data from used a simple in-memory queue to avoid sending hundreds or thousands of concurrent requests and thus to avoid being blocked. But what if you are already blocked? The site that you are scraping has already added your IP to its blacklist and you don’t know whether it is a temporal block or a permanent one.

Such issued can be resolved with a proxy server. Using proxies and rotating IP addresses can prevent you from being detected as a scraper.

He then shows how to use the clue/reactphp-buzz package to write an asynchronous HTTP request to google.com making use of promises rather than normal synchronous request handling. He then installs the clue/reactphp-socks package to make the connection to the proxy server(s) and modifies the Buzz client to use that as a connection. After finding a proxy server to use, he updates the scraper code created previously with the new Buzz+Socks combination and shows it in action scraping data. The post finishes with a look at adding some error handling and how to handle when the proxy requests authentication before use.

tagged: web scraping tutorial series part3 reactphp buzz socks proxy server

Link: https://sergeyzhuk.me/2018/06/20/fast-webscraping-with-reactphp-proxy/

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/

Auth0 Blog:
Symfony Tutorial: Building a Blog (Part 3)
Mar 27, 2018 @ 16:20:06

The Auth0 blog has posted the third part of their "Building a Blog" series of tutorials showing the use of their authentication technologies coupled with a Symfony framework backend. In this latest article author Greg Holmes shows how to deploy the application created in parts one and two to Heroku.

Symfony is a PHP framework as well as a set of reusable PHP components and libraries. It uses the Model-View-Controller design pattern and can be scaled to be used in any requirement. It aims to speed up the creation and maintenance of web applications, replacing repetitive code. In this part of the series, you will learn how to deploy the blog engine that you have created in the previous parts on Heroku. The final code can be found at this repository.

He starts with a bit of catching up, briefly covering the contents of the first two articles before getting into the main content of this third. He covers some of the basics of Heroku and Travis-CI before getting into the actual deployment flow. He then helps you set up a GitHub account (used as a source for the deployment), set up a local MySQL database for testing and the installation of a few required dependencies. Next is the installation of the Heroku and Travis-CI command line tools, the configuration for each and some basic setup steps for each service.

Finally, he gets back to the Symfony application, setting up a few additional options in the Composer configuration to create a few commands. These commands are then executed as a part of the deployment process. There's also changes to the Symfony configuration files to reference the environment rather than a local path in several locations. The post ends with the setup instructions on the Auth0 side to allow handling to work from the newly deployed Heroku instance.

tagged: auth0 blog symfony tutorial series part3 deploy heroku

Link: https://auth0.com/blog/symfony-tutorial-building-a-blog-part-3/

Christoph Rumpel:
Build a newsletter chatbot in PHP - Part 3
Mar 27, 2018 @ 15:57:24

Christoph Rumpel has continued his series covering the creation of a chatbot using the Botman package in a new post to his site. The latest post, part three in the series, builds on the base created in parts one and two and integrates the bot with his project website.

In part one and two we created a Facebook Messenger chatbot that let your users subscribe to your newsletter. We stored that information in the database and sent out our first newsletter. In the last third part, we integrate this bot to a website and write our first tests.

He then walks you through the process of using the Facebook Customer Chat Plugin to integrate it into the site (using the Facebook JavaScript SDK). He includes instructions on whitelisting your domain and including the plugin into the site's source using a few custom configuration options. With the integration complete he then takes a step back and shows the creation of several tests evaluating the fallback handling and subscription conversation responses.

tagged: chatbot tutorial series part3 integrate facebook testing fallback subscribe

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

Laravel News:
Real-time messaging with Nexmo and Laravel
Mar 05, 2018 @ 16:28:04

The Laravel News site has posted the third part of their series about the construction of helpdesk software. In this latest article they integrate Nexmo for real-time messaging using Nexmo Stitch.

Welcome back to the third and final (for now!) part of the Deskmo series. In Part 2 added support for voice calls, with text-to-speech and transcription support.

Today, we’re going to add in-app messaging using Nexmo Stitch. Stitch takes care of all of the heavy lifting for real-time chat, providing you with a websocket that you connect to and listen for events relating to your application.

The article starts by listing out some prerequisites (a Nexmo client account and the Deskmo project) as well as an installation of the Nexmo Stitch command-line client. It then walks you through the process of setting up a Nexmo user profile for each user in the helpdesk software and updating the database with this new information. It then shows how to add in-app notification messaging and linking the messages and tickets together with a conversation ID. With Stitch installed you can then create the chat interface and link the backend to the Nexmo service as a user easily sending and receiving messages.

tagged: realtime message laravel nexmo helpdesk tutorial series part3

Link: https://laravel-news.com/real-time-messaging-nexmo-laravel

Pehapkari.cz:
Domain-Driven Design - Repository
Mar 02, 2018 @ 17:46:25

The Pehapkari.cz site has continued their series on domain-driven design with their latest tutorial covering the use of a repository for handling instances and collections of objects.

We will discuss how to store and read domain objects while pretending we have an in-memory system. Simply, we will show how to implement and test repository.

The article starts with a look at collections and the reality of using them outside of an in-memory environment. It then focuses in on the idea of a repository that live in the domain layer and some of the responsibilities they have as a part of the overall system. With the basics defined the tutorial then gets into the concrete implementation of the repository and how to write effective tests to ensure its correct functionality.

tagged: domaindrivendesign series part3 repository tutorial

Link: https://pehapkari.cz/blog/2018/02/28/domain-driven-design-repository/


Trending Topics: