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

Sound of Symfony Podcast:
Episode 11 - Looking forward to Symfony 4
Feb 04, 2016 @ 09:46:01

The Sound of Symfony podcast has come back and posted their latest episode with hosts Magnus Nordlander and Tobias Nyholm. In this latest episode (#11) they talk about Symfony 4 and look forward to some of the things they'd like to see in this future release.

Having recovered from SymfonyCon and had happy holidays, Sound of Symfony is back on the ether(net). This week we talk about what we'd like to see in upcoming versions of PHP and Symfony.

Other topics mentioned include:

  • Various Drupal initiatives
  • Sub-requests (a request to render just a partial page, not the whole thing through the HttpKernel)
  • Object-oriented CSS

You can listen to this latest episode either through the in-page audio player or by downloading the audio directly. If you enjoy the episode be sure to subscribe on iTunes to get the latest episodes as they're released.

tagged: soundofsymfony podcast ep11 symfony4 drupal subrequest, oop, css

Link: http://www.soundofsymfony.com/episode/episode-11/

SitePoint PHP Blog:
Transphporm – a Different Kind of Template Engine
Dec 17, 2015 @ 09:42:54

The SitePoint PHP blog has posted a tutorial on a "different kind of template engine" that makes use of selectors and placeholders to define templates and replace data: Transphporm. In this article they introduce you to the library and give some examples of it in action.

Many PHP template engines (Smarty, Blade, Twig…) are little more than abstracted PHP code, making it easier to write loops, if/then/else blocks, and display variables with less verbosity than vanilla PHP. These traditional template engines require the designer to have an understanding of special syntax. The template engine must also be in place and operational in order to parse data and thus completely render the final design. Nothing wrong with this.

Transphporm follows a different approach that is generally known as “template animation”. What this means is that the web designer creates the entire HTML/CSS/JS page including placeholder content such as “Lorem Ipsum”, then the template engine comes along and replaces parts of the DOM with new data before the final render.

The benefit of this kind of templating is that the designer or one creating the templates doesn't need to know anything about the templating software or a special syntax. Transphporm uses CSS-style selectors to define the replacement location and the data that should fill that spot. They give an example of a simple HTML page with plenty of markup defining the locations of the placeholders. They then show how to define a "tss" configuration, listing out all of the selectors and the content to push in as a replacement. They also talk a bit about DOM concerns, what happens if the template changes and the selector is no longer valid and how to help this with partials. Finally they look at some of the more advanced features like using arrays, working with attributes and conditional changes (among others).

tagged: transphporm template language css selector tutorial

Link: http://www.sitepoint.com/transphporm-a-different-kind-of-template-engine/

SitePoint PHP Blog:
Automatic Asset Optimization with Munee
Oct 12, 2015 @ 10:26:42

The SitePoint PHP blog has posted a tutorial showing you how to optimize how your application works with assets with Munee.

Munee is a n asset management tool which can compile LESS, SCSS, or CoffeeScript, manipulate images, minify CSS and JS, and cache assets on the server and client on the fly. It works with PHP 5.3 and newer versions.

In this tutorial, we will learn how Munee makes it easy to include assets in templates, how to install it, how it works and how to use it. Munee is another way to avoid NodeJS in asset management of PHP apps.

He starts the article with a few reasons why you'd want to use Munee to manage your application's assets including automatic minification and both server and client side cache handling. He covers a bit about how it works and what it does to cache assets via simple HTTP headers. He then gets into the actual installation of the tool, the code needed to run it in your system (a one-line call) and how to have the server rewrite all the requests back to the waiting PHP file. He shows how to compile different asset types including SCSS, LESS and CoffeScript files as well as minifying Javascript and CSS. Munee also includes an on-the-fly image resize handler that will also cache the results. Finally he talks about how you can use it to combine assets and briefly about the API the library provides for some other functionality.

tagged: asset optimization munee tutorial css javascript less scss coffeescript cache

Link: http://www.sitepoint.com/automatic-asset-optimization-with-munee/

Three Devs & A Maybe Podcast:
The First All-Episode Quiz
Aug 14, 2014 @ 09:17:35

On the latest episode of the Three Devs & A Maybe podcast Michael Budd, Fraser Hart, Lewis Cains and Edd Mann have their first quiz show (Episode #38).

This week we start our chat off with the myth of just simply 'reskinning' a website, along with the dreaded !important in CSS. Following this, as we love quizzes so much, we decided to dedicate a full show to one. In this weeks quiz we touch upon many areas of PHP, JavaScript, CSS and random computer/programming history. We also now have t-shirts on sale, available via the first link in the show-notes (why don't you treat yourself).

Topics discussed in this episode include AngularJS fundamentals, speed in software development and avoiding burnout. You can listen to this latest episode either through the in-page player or by downloading the mp3 directly. If you enjoy the show also consider subscribing to their feed.

tagged: threedevsandamaybe podcast ep38 quiz episode reskin css history

Link: http://threedevsandamaybe.com/posts/the-first-all-episode-quiz/

SitePoint PHP Blog:
How to Create a Laravel CSS-Minify Command
Jun 11, 2014 @ 14:58:31

The SitePoint PHP blog has a new post today from Tounes Rafie showing you how, in a Laravel framework based application, to create a minify command with the framework's "artisan" command.

In this article you’ll learn how to use Laravel’s Artisan command line tool, and how to create a customized command. Note that you need to be familiar with the Laravel framework to get the most of this article. In this tutorial we’re going to build a command to minify our css assets.

He starts with a (very) brief look at what Laravel commands are and the options this articular one will include. Next up is the code you'll need to create the command, making use of Laravel's integration of the Symfony Console component. He shows how to register the command with the rest of the application and how to work with the options/arguments for the input. From there he shows how to run the command and how to make some other improvements including colorized output and more information on execution.

tagged: css minify command laravel artisan framework tutorial

Link: http://www.sitepoint.com/create-laravel-css-minify-command

SitePoint PHP Blog:
Getting Started with Assetic
Apr 14, 2014 @ 10:37:00

The SitePoint PHP blog has a new post from Lukas White today looking at the Assetic asset management library and how you can get started using it in your application.

There was a time when asset management meant little more than inserting a <link> tag or two and a couple of <script> tags into your HTML. Nowadays, though, that approach just won’t cut it. There’s performance, for one thing. [...] Also, as client-side applications have become more and more sophisticated, managing dependencies amongst scripts and libraries has become increasingly complex. Furthermore, technologies such as Less, Compass and Coffeescript require assets to be compiled, adding yet another step to the process of managing assets. In this article I’m going to look at a PHP package called Assetic which helps manage, compile and optimize assets such as scripts, stylesheets and images.

He briefly discusses asset management first, just to get everyone on the same page as far as what "assets" are and some considerations about their use. Next is an introduction to the Assetic library itself and the install/usage of a simple "AssetCollection" object. He also shows how to add assets to the object and how to configure compression and generation of the files (like with LESS). He also shows how to use the AssetManager and FilterManager object types along with the AssetFactory handler. Finally, he talks about some of the sample output and caching the tool can do with file-based cache handling.

tagged: assetic introduction asset tutorial javascript css less compress

Link: http://www.sitepoint.com/getting-started-assetic

PHPClasses.org:
Using Composer to Install JavaScript, CSS & Images Under the Web Document Directory
Jan 07, 2014 @ 12:36:07

On the PHPClasses.org site today there's a new post showing how to install more than just PHP packages with Composer including things like Javascript, CSS and image files.

By default Composer installs all package files under the vendor directory. If you want to install asset files in the Web document root directory, you need to resort to another solution. This Asset Manager package is a plugin that extends Composer to install any package files outside the vendor directory. Additionally, it can also read the user names and passwords from a configuration file, so you do not have to enter them every time Composer retrieves packages from repositories that may require authentication, like PHP Classes and JS Classes.

Using an asset manager plugin for Composer, he shows how to include an "extra" section into your "composer.json" for the other files. There's also an example of how to implement a custom installation action that, in this case, was used to implement the "extras" functionality. The post finishes up with a look at handling authentication in the Composer requests, using the same tool to parse a "config" section with Basic HTTP authentication information.

tagged: composer package install javascript css image assets http authentication

Link: http://www.phpclasses.org/blog/package/8429/post/1-Using-Composer-to-Install-JavaScript-CSS-and-Images-Under-the-Web-Document-Directory.html

NetTuts.com:
Building Ribbit in PHP
Jan 04, 2013 @ 10:22:48

In the first part of a new series on NetTuts.com, they started on the creation of a full web application (a Twitter clone). The first article covered the CSS and using LESS to create an interface. In this second post they get into the PHP backend, opting to create it without a framework on the first shot.

In the initial entry in this series, we took care of the UI-aspect of our Twitter-clone, called Ribbit. Now, we’ll begin coding the application in a number of languages. This lesson will leverage standard PHP (with homegrown MVC), but, in future articles, we’ll review other implementations, such as with Rails or Laravel.

They provide all the code you'll need, the database table structure to power it (MySQL) and the examples of a model, router and basic MVC stack to handle the requests. They help you make a user creation and login system as well as a few other pages ("buddies", "make a post" and a few others). You can also download the source from their Github account if you want it all in one shot.

tagged: ribbit backend tutorial series css less mvc

Link:

Codeception Blog:
The Locator Class
Sep 27, 2012 @ 09:50:34

The Codeception blog (a BDD testing tool) has a new post on using their Locator class to create more complex tests based on XPath or CSS selectors.

In the latest Codeception 1.1.4 new Locator class was introduced. Basically it should simplify your life in writing complex XPath or CSS locators. Right now it has minimal, yet useful functionality.

The post shows how to combine more than one item for location with either a tag, CSS-based or XPath-based selector. It also shows how to use the "tabindex" method to simulate the movement through a page using the "Tab" key. Finally, there's a quick piece of code showing how to locate an item based on the "href" value. For more information on using Codeception, check out their documentation or the project's main site.

tagged: locator class css xpath combine tab href

Link:

ScreenFony.com:
Work with bootstrap, assetic and less
Sep 25, 2012 @ 10:36:20

On the ScreenFony.com site there's a quick tutorial showing you how to get started with Symfony2+Twitter Bootstrap+Assetic+LESS in a basic application. Assetic is a library that helps with asset management and use and LESS is a CSS pre-processor that makes it simpler to work with your site's CSS.

Bootstrap is a well known and powerful front-end framework for fast prototyping, it uses LESS and it can be easily integrate in your Symfony applications with the help of assetic. In this post I’ll show how to: Install bootstrap in you Symfony application, load it using assetic, and compile bootstrap LESS files with lessphp.

Using Composer, creating a new Symfony2 project is just a single command away. The just update the "composer.json" and run the install to get the other needed libraries (LESS and the Twitter Bootstrap). They help you set up some Assetic filters for LESS and provide a simple page to output the Bootstrap in your header.

tagged: symfony2 assetic twitter bootstrap less css tutorial composer

Link: