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

Dragos Holban:
How to Setup Docker for Your Symfony Project
Sep 18, 2017 @ 11:48:31

In a tutorial posted to his Medium.com site Dragos Holban continues his series walking you through Symfony for PHP applications. In this latest part of the series he shows you how to use Docker to set up an environment for a Symfony-based application.

As you probably know, I am a big Symfony fan :) In the last few years I used Vagrant to set up my Symfony development environment more or less as described here. But we now have Docker and it’s time to move forward with a new setup. Docker containers are generally more lightweight than Vagrant virtual machines, so starting and stopping them is extremely fast. They also take a lot less disk space.

He starts by sharing an example Dockerfile and docker-compose.yml to help set up and configure the environment to be ready for use. The configuration sets up Apache, PHP 7, MySQL, git, Composer and several PHP extensions. It then installs a fresh instance of Symfony and runs a bash file to finish the setup. He shares the contents of this file and the VirtualHost configuration for the web server. Finally he shows how to run the setup via the Docker command line tool and what you can expect to see when things are running smoothly.

tagged: docker symfony setup configure dockerfile compose tutorial series

Link: https://medium.com/@dragosholban/how-to-setup-docker-for-your-symfony-project-ff9b1bf44e68

Adam Culp:
Easy Docker dev environments for PHP with CloudEstuary
Apr 17, 2017 @ 15:14:09

Adam Culp has written up a new post to his site showing you how to use the CloudEstuary service to easily create Docker development environments for your day to day work.

Lately I’ve been messing around with Docker, and specifically with containerizing PHP applications to perform quick services, such as static analysis of PHP code, compatibility of existing PHP code to specific versions of PHP, and performing security checks on PHP libraries included in my projects. However, I’ve not created a development environment for my projects using Docker.

[...] But today I found another way [besides using Vagrant]. A way to easily create PHP development environments with Docker. The fine folks at CloudEstuary have created an easy to use web-based tool to create PHP development environments (yml files) for use with Docker-compose.

He then walks you through the process of creating a new environment, selecting the framework to be installed by default and other "add-ons" to be include (it also allows for the addition of workers). After clicking on the "Generate Docker Compose" button the service spits out the YAML configuration file you can then use to create the environment. There's a few tweaks he recommends making to the config and, finally, the command to use the configuration and bring the environment up.

tagged: docker cloudestuary service compose tutorial configuration

Link: http://www.geekyboy.com/archives/1321

Fabien Potencier:
Symfony 4: Compose your Applications
Apr 03, 2017 @ 10:31:26

On his site Fabien Potencier has posted an article about the next major release of the Symfony framework - version 4 - and how it will allow for the "composition" of your applications rather than some of the current methods.

Symfony 3.0 was boring, a cleaned-up version of the Symfony 2.8 version. Symfony 4.0 will be different: Symfony 4.0 = Symfony 3.4 - deprecated features + a new way to develop applications

There is another way to think about a new major version though: Symfony 4.0 = Symfony 3.0 + all features added in 3.x - deprecated features + a new way to develop applications

He goes through some of his thinking process around some of these changes and the "day-to-day experience" of managing a Symfony application. Specifically he suggests that:

  • Installing a Bundle is too cumbersome
  • Removing a Bundle is even more cumbersome
  • The Symfony Standard Edition is not good enough
  • No Distribution Ecosystem

He ends the post with a look at what he sees as the ideal ecosystem for the framework and where Symfony Flex fits into the picture (example project here).

Symfony Flex is going to be the default way to manage Symfony 4 applications. But Symfony Flex will be available as an option to manage Symfony 3.3 and 3.4 applications as well! That said, we might need to break backward compatibility between now and the launch of Symfony 4. Consider Symfony Flex as alpha before Symfony 4.
tagged: symfony symfony4 compose application progress ecosystem

Link: http://fabien.potencier.org/symfony4-compose-applications.html

James Wade:
Getting started with Docker and Wordpress
May 06, 2016 @ 11:57:31

James Wade has posted a tutorial to his site showing you how to combine Docker and WordPress after some experimentation of his own.

I’ve been meaning to get started with Docker since hearing about it in 2014. Having really enjoyed working with Vagrant, I’ve struggled to make a leap into the Docker realm. [...] My understanding at the moment is that docker takes up less resources, which for me is becoming more and more of an issue as I attempt to expand my development environments. Also, I’ve recently inherited a number of Vagrants that I discovered have varying operating systems and application versions, that vary from production.

This has unravelled a dependency hell when I came to build a continuous integration process. In light of this, at this stage, a complete rewrite of the architecture seems to be emerging as the most sensible way to being all the services in to line. I’ll be looking whether I can solve these problems (amongst others) with Docker.

He starts by helping you get all the tools you'll need installed with examples for multiple platforms (OSX, Windows, Unix-based). With those in place he helps you set up a VM as a Docker machine then get WordPress installed (complete with its database). He also shows how to use Docker Compose, using an existing WordPress instance and creating a custom image from the results (including database, environmental settings and hostname configuration).

tagged: docker wordpres tutorial example compose setup configure vm virtualmachine

Link: http://wade.be/development/2016/05/02/docker.html

Timothy Boronczyk:
Composing Music with PHP
May 29, 2013 @ 10:56:37

Timothy Boronczyk has a recent post to his site with an interesting thing to use PHP for - composing music.

I'm not an expert on probability theory, artificial intelligence and machine learning, and even my Music 201 class from years ago has been long forgotten. But if you'll indulge me for the next 10 minutes, I think you'll find that even just a little knowledge can yield impressive results if creatively woven together into an application. I'd like to share with you how PHP can be taught to compose music.

He shows examples of some basic melodies generated by PHP (not the prettiest) and talks about how he "taught" PHP to get better at it. He transcribed other music into Scientific Pitch Notation and used a Markov process to create a "next note selection" method based on the notes around it. He includes the code for his "robot composer" class with its "train" and "compose" methods and and example of its usage.

tagged: compose music scientific pitch notation markov process train compose

Link: http://zaemis.blogspot.com/2013/05/composing-music-with-php.html

Timothy Boronczyk:
Composing Music with PHP
May 29, 2013 @ 10:56:37

Timothy Boronczyk has a recent post to his site with an interesting thing to use PHP for - composing music.

I'm not an expert on probability theory, artificial intelligence and machine learning, and even my Music 201 class from years ago has been long forgotten. But if you'll indulge me for the next 10 minutes, I think you'll find that even just a little knowledge can yield impressive results if creatively woven together into an application. I'd like to share with you how PHP can be taught to compose music.

He shows examples of some basic melodies generated by PHP (not the prettiest) and talks about how he "taught" PHP to get better at it. He transcribed other music into Scientific Pitch Notation and used a Markov process to create a "next note selection" method based on the notes around it. He includes the code for his "robot composer" class with its "train" and "compose" methods and and example of its usage.

tagged: compose music scientific pitch notation markov process train compose

Link: http://zaemis.blogspot.com/2013/05/composing-music-with-php.html

DevShed:
Composing Messages in HTML for MIME Email with PHP
Jul 30, 2008 @ 14:34:59

DevShed continues its look at sending MIME emails with PHP in the fourth part of the series - a method for sending HTML in the message.

In this article, I'm going to show you how to provide the MIME mailer class with the ability to send email messages in HTML format. This will greatly extend its functionality, so don't miss this tutorial.

They start by reviewing the class they've created so far, including an example of its use. From there they modify it slightly to make it easy to embed the HTML content into the email by adding the addHTML and buildHTMLPart methods.

tagged: compose email tutorial mime html content

Link:

Tim Koschuetzki's Blog:
Composing Methods: Substitute Algorithmn
Aug 16, 2007 @ 08:26:00

Tim Koschuetzki has another in his "Composing Methods" series posted today - this one taking a look at something called the "substitute algorithm". It's a method of replacing content in a simpler way than using multiple ifs (as replaced by array functions).

Programming is such a dynamic action that you often find yourself having to replace an algorithmn all together. It will be much easier to do if the current algorithmn is an easy one already. [...] Make sure you decompose your algorithmns as much as you can and use many small methods for it.

His example replaces multiple if statements to search through an array with a simple in_array statement, returning the selected array index from there.

tagged: method compose substitute algorithm replace search method compose substitute algorithm replace search

Link:

Tim Koschuetzki's Blog:
Composing Methods: Substitute Algorithmn
Aug 16, 2007 @ 08:26:00

Tim Koschuetzki has another in his "Composing Methods" series posted today - this one taking a look at something called the "substitute algorithm". It's a method of replacing content in a simpler way than using multiple ifs (as replaced by array functions).

Programming is such a dynamic action that you often find yourself having to replace an algorithmn all together. It will be much easier to do if the current algorithmn is an easy one already. [...] Make sure you decompose your algorithmns as much as you can and use many small methods for it.

His example replaces multiple if statements to search through an array with a simple in_array statement, returning the selected array index from there.

tagged: method compose substitute algorithm replace search method compose substitute algorithm replace search

Link:

Tim Koschuetzki's Blog:
Composing Methods: Remove Assignments to Parameters
Jul 06, 2007 @ 10:21:00

In another part of his "Composing Methods" series, Tim Koschuetzki posts about removing assignments to parameters today - working with a temporary variable inside a method rather than the actual passed in value.

When your code assigns to a parameter in a function/method, use a temporary variable instead. [...] It will make your code much more readable and prevents by-reference confusion and therefore big problems in the future.

His example code uses the illustration of calling a price() method in a class to modify the inputVal value based on other inputted information. His suggestion is to not work with the actual inputVal value passed in (so as to avoid issues if it happens to be passed my reference later), but to work with a temporary variable - $result - inside the method.

tagged: method compose remove assignment parameter temporary variable method compose remove assignment parameter temporary variable

Link: