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

Introducing Laravel Mix (new in Laravel 5.4)
Feb 09, 2017 @ 15:23:40

Matt Stauffer has posted the latest in his "What's new in Laravel 5.4' series with this new post covering Laravel Mix. Mix is a reworking of the Laravel Elixir package in previous framework releases but has changed a few things up in the process.

Laravel Mix. The same and yet entirely different from Laravel Elixir.

If you're not familiar with Laravel Elixir, it's a wrapper around Gulp that makes it really simple to handle common build steps—CSS pre-processing like Sass and Less, JavaScript processing like Browserify and Webpack, and more.

In Laravel 5.4, Elixir has been replaced by a new project called Mix. The tools have the same end goals, but go about it in very different ways.

He starts with a look at what's new about Mix and how it differs from previous version of Elixir. This includes changes in the structure of the configuration file, a different files/folders structure, helpers and quite a few other changes. Matt gets into detail on each item, providing code examples for the changes and a brief summary of how it's different for those that might have used Elixir before. Check out the full post for the full details.

tagged: laravel mix elixir css javascript compile helper v54 framework

Link: https://mattstauffer.co/blog/introducing-laravel-mix-new-in-laravel-5-4

SitePoint PHP Blog:
How PHP Executes – from Source Code to Render
Jan 03, 2017 @ 18:33:41

The SitePoint PHP blog has a new tutorial posted by author Thomas Punt that walks you through the execution of PHP - a "behind the scenes" look at how the PHP processing engine does its magic.

Inspired by a recent article on how Ruby code executes, this article covers the execution process for PHP code. [...] There’s a lot going on under the hood when we execute a piece of PHP code.

He then walks you through the four main steps the engine goes through to turn your PHP code into results: lexing, parsing, compilation and interpretation. For each stage in the process there's a brief description of what piece(s) of the language are doing the work and some examples of how to see the results in more user-land PHP code (like with the AST parser).

tagged: tutorial execute language lexing parsing compile interpret

Link: https://www.sitepoint.com/how-php-executes-from-source-code-to-render/

Michelangelo van Dam:
PHP 7 on macOS Sierra
Sep 26, 2016 @ 14:24:18

Michelangelo van Dam has posted a "follow up" to his previous article about setting up a PHP installation on the recent versions of Mac OSX. In this new tutorial he makes some updates for the latest OS X release: Sierra.

Apple has released the latest version of their OS X operating system to the broad public and many have already upgraded their mac devices. But as it goes with each release, Apple likes to do things a bit different making it quite challenging for PHP developers to stay current with the latest PHP version (or other versions).

This version of mac OS (11.12) comes pre-installed with PHP 5.6.24. [...] Good for Apple, but this version reaches end-of-life support by the end of this year, so it would be great if you could upgrade to PHP 7.0 or even play with the latest PHP 7.1 release candidates.

While he points out that things like XAMPP and Homebrew can be used to set the installation up, he focuses more on compiling and installing it natively. He shares an issue he had with a missing runtime and how to get it installed and working happily so the PHP compile completes without issues.

tagged: mac osx runtime compile php7 sierra issue tutorial

Link: http://www.dragonbe.com/2016/09/php-7-on-macos-sierra.html

Michelangelo van Dam:
Compile PHP 7 on Mac OS X 10.11 "El Capitain"
Jul 19, 2016 @ 14:34:33

In a new post to his site Michelangelo van Dam has posted a guide to compiling PHP 7 on OSX "El Capitan", the latest release of the popular Apple operating system.

Apple has made a numerous changes to the way OS X (10.11) "El Capitain" uses open source elements like PHP and OpenSSL. Compiling PHP from source requires a bit more modifications.

This article is a follow-up on my previous post <a href='http://www.dragonbe.com/2015/12/installing-php-7-with-xdebug-apache-and.html">Installing PHP 7 with XDebug, Apache and MySQL on OS X Yosemite.

He then provides the commands and configuration information you'll need to get things up and running:

  • OpenSSL
  • PHP 7
  • Apache

The end result is a simple PHP 7 installation with plenty of features installed.

tagged: compile php7 mac osx elcapitan openssl apache

Link: http://www.dragonbe.com/2016/07/compile-php-7-on-mac-os-x-1011-el.html

Michelangelo van Dam:
Installing PHP 7 on OS X Yosemite
Dec 07, 2015 @ 15:40:34

Michelangelo van Dam has a post to his site, now that PHP 7 is released, showing you how to get it installed on OSX (Yosemite) for your local development.

Yesterday was the release of PHP7.0.0 and I wanted to have it on my mac as fast as possible. Since I'm still using Mac OS X Yosemite I will post here the steps to upgrade my platform, it might be useful for you too.

He starts with the requirements needed for the installation including XCode to be able to compile the PHP from scratch and the latest download of PHP 7 from php.net. He then talks about the benefits of compiling your own installation and shares a script that he uses to compile the PHP version he wants (based on a command line option). Once this is run the typical make and make install are executed and, if all goes well, your output for a /opt/php7/bin/php -v will look the same as his.

tagged: install php7 osx yosemite script compile custom module

Link: http://www.dragonbe.com/2015/12/installing-php-7-on-os-x-yosemite.html

SitePoint PHP Blog:
Meet Elixir, the Laravel Way of Compiling Assets
Nov 12, 2015 @ 16:41:45

The SitePoint PHP blog has a new tutorial posted introducing you to Elixir, the "Laravel way" of working with assets in your application and making it easier and more unified.

In today’s web applications, we use a wide variety of tools to speed up the development workflow while keeping the code base as lean as possible. [...] One such type of tool are preprocessors for CSS and JavaScript. [...] Besides preprocessors, there are also many tasks we as developers often have to do, including linting JS files, testing, concatenation, minification, just to name a few.

All this led to the creation of JavaScript-based task runners like Grunt and Gulp. [...] Gulp syntax is clean and easy to use, but there’s always room for doing things the easier way. Laravel 5 introduced Elixir: a Node.js based tool developed by Jeffrey Way, which manages our Gulp tasks the easy way.

They start with the requirements you'll need to get Elixir up and running, including Node.js and Gulp itself (it's a "frontend" for it, not a replacement). They talk about where Elixir assumes your assets will live and some examples of:

  • Compiling Less files
  • Compiling CoffeeScript files
  • Compiling multiple files at once
  • Using different source and output directories
  • Concatenation files

...and much more. They also show how to perform Jade->Blade compilation for templating and how to configure Elixir to match your needs. The post ends with a more "real world" example with a full site structure, how to run the tasks and some more advanced topics (like custom tasks and using the assets in Blade templates).

tagged: elixir tutorial introduction assets compile gulp nodejs

Link: http://www.sitepoint.com/meet-elixir-the-laravel-way-of-compiling-assets/

Emanuele Minotto:
About Composer commands
Nov 11, 2015 @ 16:50:38

In this post to his site Emanuele Minotto looks at commands in Composer. This functionality lets you execute "commands" with Composer command line options. These are not the same as the "scripts" functionality that allows you to specify shell commands to execute when certain events are fired.

Recently I’m considering a not-so-common Composer feature: commands (scripts). Composer already provides some hooks, you can find the list of provided hooks here: getcomposer.org/doc/articles/scripts.md#event-names

These hooks you see aren’t the same commands I mean in this article, because can’t be invoked using "composer post-install-cmd", I’m going to list some scripts I found useful, but before let me explain some reasons why I think they should be included in your composer.json.

He starts by answering a few of the common questions about this command handling including how it should be done can be tested. He then covers three commands you can use to help with testing these commands:

  • composer test
  • composer compile
  • composer check-style

For each he provides an example of the configuration in the "scripts" section of the composer.json file when each of these special command line options are used.

tagged: composer commands test compile checkstyle

Link: http://emanueleminotto.github.io/blog/about-composer-commands/

HHVM Blog:
The Journey of a Thousand Bytecodes
Oct 06, 2014 @ 17:49:38

In the latest post to the HHVM (HipHop VM) blog Sara Golemon recounts the journey of a thousand bytecodes and the process that it takes to decompose a PHP file and optimize it for execution in the HHVM environment.

Compilers are fun. They take nice, human readable languages like PHP or Hack and turn them into lean, mean, CPU executin’ turing machines. Some of these are simple enough a CS student can write one up in a weekend, some are the products of decades of fine tuning and careful architecting. Somewhere in that proud tradition stands HHVM; In fact it’s several compilers stacked in an ever-growing chain of logic manipulation and abstractions. This article will attempt to take the reader through the HHVM compilation process from PHP-script to x86 machine code, one step at a time.

The process is broken down into six different steps, each with a description and some code examples where relevant:

  • Lexing the PHP to get its tokens
  • Parsing the token results into an AST (and optimizing it along the way)
  • Compilation to Bytecode
  • HHBBC Optimization
  • Intermediate Representation
  • Virtual Assembly
  • Emitting machine code
tagged: hhvm bytecode process hiphop compile decode optimize

Link: http://hhvm.com/blog/6323/the-journey-of-a-thousand-bytecodes

Anthony Ferrara:
Introducing Recki-CT
Sep 01, 2014 @ 15:56:46

Anthony Ferrara has introduced an interesting new tool in his most recent post, a compiler toolkit for PHP: Recki-CT.

Over 1.5 years ago, I introduced PHPPHP to the world. It was the first implementation of the PHP language written in PHP itself. But PHPPHP suffered from a few problems which relegated it to toy status (such as performance). Today, I get to introduce you to another implementation of PHP, written in PHP. But this one is no toy. This one... This one is fun...

He goes on to introduce the tool, pointing out what it is (and isn't) and how it compiles the PHP down into machine code. He covers the difference between it and things like HHVM and some benchmarks on how fast the resulting code performs. He also gives some thanks to people who helped him along the way (as well as sone of the projects it relies on). If you're interested in finding out more, check out the project's GitHub page for complete info and the latest version.

tagged: reckict project compile language phpphp

Link: http://blog.ircmaxell.com/2014/08/introducing-recki-ct.html

Lorna Mitchell:
Compiling PHP Extensions
Aug 29, 2014 @ 14:28:42

Lorna Mitchell has posted a quick guide to compiling PECL extensions to her site today. This is for those users on unix-based systems that might need to manually compile with some custom options (or may be working on your own extension and may just need to test it).

There are lots of reasons why you might like to compile your own PHP extensions. [...] I haven't seen a really approachable guide anywhere, we tend to speak of extensions in hushed tones, and actually it isn't particularly tricky so here is my quick how-to guide.

The process is relatively simple for those familiar with the command line and the steps involved in compiling software. There's some special PHP-only steps you'll have to take before compiling the code to make sure it's ready to be a PHP extension. Then it's up to the usual configure+make_make install to ensure the .so file is correctly generated.

tagged: compile extension tutorial phpize module

Link: http://www.lornajane.net/posts/2014/compiling-php-extensions


Trending Topics: