Bernhard SchussekPuli 1.0-beta8 Released (5.10.2015, 15:30 UTC)

Today marks the release of Puli 1.0-beta8. This version features the following changes:

  • Support for discovering PHP classes in Puli packages.
  • Support for loading bindings that match dynamic expressions.
  • Full Windows support.
  • Support for migrating puli.json automatically.
  • Fixed various bugs in the path-mapping repository.

Continue reading to learn more about these changes.

Class Discovery

Puli's Discovery component was extended to discover not just resources, but also PHP classes in your Puli packages. A classic example where this feature is needed is a plugin system. As example, consider a batman/core package that provides an Application class and a Plugin interface for hooking plugins into that application. The Application class is used like this:

use Batman\Core\Application;

// load Composer's autoloader
require_once __DIR__.'/vendor/autoload.php';

// create the application
$app = new Application([
    new BlogPlugin(),
    new CommentsPlugin(),
    // ...

Whenever you install a new plugin, you need to add the corresponding Plugin class to the application. With this Puli release, you can do better.

Implementing the Plugin Infrastructure

In the batman/core package, add a binding type for the Plugin interface to puli.json:

$ puli type --define Batman\\Core\\Plugin

Change the Application class to load the plugins from Puli's Discovery:

namespace Batman\Core;

use Puli\Discovery\Api\Discovery;

class Application
    public function __construct(Discovery $discovery)
        foreach ($discovery->findBindings(Plugin::class) as $binding) {
            $pluginClass = $binding->getClassName();

            $this->registerPlugin(new $pluginClass());

Any plugin can now bind its plugin class to the binding type Batman\Core\Plugin defined in the batman/core package.

Registering a Plugin

As example, let's register the BlogPlugin class in the puli.json file of the batman/blog package:

$ puli bind Batman\\Blog\\BlogPlugin Batman\\Core\\Plugin

Using the Application

Users of your packages now instantiate the application like this:

use Batman\Core\Application;

// load Composer's autoloader
require_once __DIR__.'/vendor/autoload.php';

// load Puli's Discovery service
$factoryClass = PULI_FACTORY_CLASS;
$factory = new $factoryClass();
$repo = $factory->createRepository();
$discovery = $factory->createDiscovery($repo);

// create the application
$app = new Application($discovery);

Any installed plugin will be recognized and loaded automatically.

Use Expressions to Load Bindings

The Discovery component now uses the Webmozart Expression library to load bindings that match specific criteria. For example, let's load all bindings for the thor/message-catalog binding type that have the parameter domain set to admin:

use Webmozart\Expression\Expr;

$expr = Expr::method('getParameterValue', 'domain', Expr::same('admin'));
$bindings = $discovery->findBindings('thor/message-catalog', $expr);

Another example: Let's load all classes bound to the Plugin binding type that are located in the Webmozart\ namespace:

use Webmozart\Expression\Expr;

$expr = Expr::method('getClassName', Expr::startsWith('Webmozart\\'));
$bindings = $discovery->findBindings(Plugin::class, $expr);

Windows Compatibility

All Puli repositories are now continuously tested on Windows thanks to AppVeyor. This change helped us to spot and fix various Windows issues. As of today, all Puli repositories build successfully on Windows.

JSON Migrations

In the past, you had to manually adapt your puli.json files when upgrading to a new beta release where the structure of that file had changed. As of this release, there is a puli upgra

Truncated by Planet PHP, read more at the original (another 1808 bytes)

PHP ClassesStarting Long Server PHP Scripts and Monitor their Status Part 3: Running Multiple Parallel Tasks (5.10.2015, 07:34 UTC)
By Joseluis Laso
In the previous parts of this article it was presented a solution to run a task on the server that could take a long time to complete and still be able to monitor its progress. However it was limited to running one task at a time.

Read this article to learn how to run multiple long tasks on the server in parallel taking the most of the available server resources. You can also watch a video of the example solution in action.
Hasin HayderCreating a slack bot using PHP to monitor your envato sales (4.10.2015, 20:07 UTC)
Thijs FerynInterviewing Michelle Sanver and discussing Drupal 8, Drupalcon & Michelle’s move to Zürich (3.10.2015, 15:33 UTC)

I was at Drupalcon in Barcelona last week and talked to a lot of cool people. Michelle Sanver is one of them.

The post Interviewing Michelle Sanver and discussing Drupal 8, Drupalcon & Michelle’s move to Zürich appeared first on Thijs Feryn's blog.

SitePoint PHPBuilding Custom cTools Plugins in Drupal 7 (2.10.2015, 16:00 UTC)

cTools is one of those critical Drupal 7 modules many others depend on. It provides a lot of APIs and functionality that makes life easier when developing modules. Views and Panels are just two examples of such powerhouses that depend on it.

cTools makes available different kinds of functionality. Object caching, configuration exportability, form wizards, dialogs and plugins are but a few. A lot of the credit you would normally attribute to Views or Panels is actually owed to cTools.

Drupal logo

In this article, we are going to take a look at cTools plugins, especially how we can create our very own. After a brief introduction, we will immediately go hands on with a custom module that will use the cTools plugins to make defining Drupal blocks nicer (more in tune to how we define them in Drupal 8).


cTools plugins in Drupal 7 (conceptually not so dissimilar to the plugin system in Drupal 8) are meant for easily defining reusable bits of functionality. That is to say, for the ability to define isolated business logic that is used in some context. The goal is to set up that context and plugin type once, and allow other modules to then define plugins that can be used in that context automatically.

If you’ve been developing Drupal sites for more than a year you’ve probably encountered cTools plugins in one shape or form. I think the first plugin type we usually deal with is the content_type plugin which allows us to create our own custom panel panes that display dynamic content. And that is awesome. Some of the others you may have encountered in the same realm of Panels are probably context and access (visibility rules). Maybe even relationships and arguments. These are all provided by cTools. Panels adds to this list by introducing layouts and styles that we normally use for creating Panels layouts and individual pane styles. These are I think the more common ones.

However, all of the above are to a certain extent a black box to many. All we know is that we need to define a hook to specify a directory and then provide an include file with some definition and logic code and the rest happens by magic. Going forward, I would like us to look into how a plugin type is defined so that if the case arises, we can create our own plugins to represent some reusable bits of functionality. To demonstrate this, we will create a module that turns the pesky hook system of defining custom Drupal blocks into a plugin based approach similar to what Drupal 8 is using.

The final code (+ a bit more) can be found in this repository if you want to follow along. And I do expect you are familiar with the steps necessary for defining custom Drupal blocks.

Continue reading %Building Custom cTools Plugins in Drupal 7%

Evert PotGoing freelance (2.10.2015, 13:40 UTC)

Dear readers,

As of October I'm switching things up a bit, and giving the freelance life a shot again.

It's a bit of a scary step! If you know anyone who might need a PHP programmer for a short or long-term project, perhaps you can consider me!

My resume is right here at: My end game is to work regularly for a small set of recurring customers, but any step that helps me get there is very appreciated!


nick halsteadIn Defense of WebSummit (2.10.2015, 10:02 UTC)


I really don’t often comment on the news but the last couple of weeks I have seen a consistent pattern of attack on WebSummit by those who really should know better, I won’t name names but I count the people who are attacking WebSummit + Paddy Cosgrove amongst my friends and I want to put forward a view from someone who is independent of any commercial bias – i.e. I don’t own a newsite (that is affiliated with other events) or run my own events.

I have been to WebSummit for the last 4 years (it could be 5 I lose track!) – I remember the day very vividly that Paddy reached out to me out of the blue with what seemed at the time like a crazy made up story, he told me he was getting together hundreds of founders, including the likes of Jack Dorsey, Chad Hurley, Michael Birch and many more for a Founders only event, I must admit at the time I was pretty damn skeptical, I had never heard of the event which was unusual, and it just seemed ludicrous that you could get that number of big name founders to all gather together in one spot. I called a few other Founder friends and they confirmed they were also going. I immediately called Paddy back and said I would attend.

I won’t cover F.ounders in detail but it has been over the years (along with Founders Forum) been the most important event I attend each year – every year I meet and connect with people who have in some way massively influenced me and help me on the journey. Also the importance of F.ounders is that it is in itself a massive draw – and it lets Paddy use that to get the biggest names in the world on stage.

Every year I spend a good amount of time at the WebSummit as well (F.ounders occurs after the end of WebSummit) – I don’t often sit and listen to the talks, but given the big names that every year speak and that the halls are bursting to the seams most of the time I can only believe they are good. I like to spend my time walking the halls looking at what the startups are doing – and this gets to the core of the attacks that WebSummit is getting, that he is charging for startups to attend.

As a starting point – every year when I walk around what absolutely blows me away is that the halls are literally solid with people, that every single pod / booth with a startup on is overloaded with attendees. DataSift has had booths at pretty much every major Tech conference – and I can tell you 90% of them you spend most of the time twiddling your thumbs while you wait for people to come out of the sessions. That includes other big conferences like Techcrunch Disrupt (we were finalists in 2010? in SF)

Back to the money – I have had to pay for pretty much every event we have had a booth at, (I think we got some free space one year back in the days of FOWA) – but in general we paid (in cash or sometimes in-kind of supply of our own services), and each time I did what every startup should do – look at the cost and look at what the potential upside is. It is massively disingenuous to say that startups should not pay, everyone has a business model for events, things have to get paid for, booth setup costs are huge, so either sponsors pay, investors pay, attendees pay, or the startups pay or some ratio of all of them.

I don’t like ‘free’ – it means I have become the monetisation – i.e. someone else is paying for me to be there – and they want something from me. To say anything different is just trying to hide the model.

So in summary – in general with your eyes wide open – you mostly get what you pay for in this world (always negotiate!) – WebSummit is an amazing event for getting in front of a huge audience of developers and investors.

Truncated by Planet PHP, read more at the original (another 831 bytes)

Cal EvansInterview with Mikhail Vink (2.10.2015, 05:00 UTC) Link
Lorna MitchellPHP Learning Path from O'Reilly (1.10.2015, 10:23 UTC)

I'm very excited to announce that some of my content is featured in the PHP Learning Path from O'Reilly. The Learning Paths are a good way to buy a bundle of content from different people on related topics, and the introductory pricing is always a good deal! Their newest offering is the PHP Learning Path, which has a video course on PHP and MySQL, my intermediate PHP Video course (they wouldn't let me call it "all the things Lorna thinks PHP developers need to know" unfortunately!) and also my video course Git for Web Developers which has a bunch of PHP in it as well as my best git tips and tricks.

I think it's a pretty well-rounded collection and it's only $99 for a couple of weeks, so get the PHP Learning Path here and let me know what you think?

PHP Learning Path from O'Reilly was originally published on LornaJane by Lorna. Lorna is a web development consultant, tech lead, author, trainer, and open source maintainer, and she is occasionally available for freelance work.

PHP ClassesCreate Microsoft Word DOCX files from HTML in PHP Part 1: Simple Example (1.10.2015, 04:03 UTC)
By Ashraf Gheith
Many PHP applications require to export documents in Microsoft Word formats. However, most PHP developers only have experience in generating HTML Web pages.

Read this article to learn how to quickly create Microsoft Word DOCX format using HTML templates.
LinksRSS 0.92   RDF 1.
Atom Feed   100% Popoon
PHP5 powered   PEAR
ButtonsPlanet PHP   Planet PHP
Planet PHP