Skip to main content

Composer Support for ProcessWire Modules

·272 words·2 mins
Hari KT
Author
Hari KT
Freelancer | Founder of Tripti and Tanvish | Maintainer of Aura for PHP, created by Paul M Jones
Table of Contents

I am a huge fan of composer. PW ( ProcessWire) is missing one of the good parts of composer. So here is a new installer to install the 3rd party modules of PW via composer.

If you have created a module for PW, what you need to do is add a composer.json file in your github repo and add it to packagist. An example composer.json is

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
{
    "name": "vendor/package-name",
    "type": "pw-module",
    "description": "Your module what it does",
    "keywords": [ "keywords", "comma", "seprated"],
    "homepage": "https://github.com/harikt/Assets",
    "license": "BSD-2-Clause",
    "authors": [
        {
            "name": "Assets Contributors",
            "homepage": "https://github.com/harikt/Assets/contributors"
        }
    ],
    "require": {
        "php": ">=5.3.0",
        "hari/pw-module": "~1.0"
    }
}

Note the minimum requirement is PHP 5.3 for composer is 5.3 .

An example of a module that works with this is https://github.com/harikt/Assets ( Move the index.php to any where :-) ). You are read more about Assets from here

Installing modules
#

How do you install the PW modules and the 3rd party dependencies ? Assuming you are in the PW folder.

First download composer from http://getcomposer.org/download/.

Hope you have composer.phar now.

1
php composer.phar require vendor/package-name version-name

Will install if the vendor/package-name to site/modules/PackageName. All packages vendor/package-name of "type": "pw-module" will be converted to PackageName.

Example you can try

1
php composer.phar require hari/assets dev-master

Try the above and see where it is installed. If you are a module maintainer, please add a composer.json to your github module and add it to packagist.

Of-course inspired and modified composer installer from Aura Project for PHP

Thank you. Happy PhPing!

Related

Assets for ProcessWire

·233 words·2 mins
Processwire is a content management framework. I was looking to change the directory structure of the Processwire. 1 2 3 4 5 |-- index.php |-- installer.php |-- README.md |-- site `-- wire I am not the first person to talk on the subject. There are other threads like Installation paths and moving folders, Common practices Anyway I thought of trying the same and for serving the js, css, images I wrote my first processwire module Assets

Aura System Released Beta 5

·99 words·1 min
Yesterday Paul M Jones tagged the beta5 for the system repo. So you can download the system from http://auraphp.com/system/downloads/ via composer # Creating aura framework based projects has been made easy with composer. You can run php composer.phar create-project -s dev aura/system your-directory What it does is almost similar to git clone and installing via git as below

Using Aura.Dispatcher in Silex

·527 words·3 mins
2 days back Paul M Jones wrote an awesome post A Peek At Aura v2 – Aura.Dispatcher the idea behind Aura.Dispatcher and how it was born. So today, let us try to integrate Aura.Dispatcher with Silex. This post is inspired by the comment made by Luis Cordova. Thank you. 1 2 3 composer create-project silex/silex --no-dev silexproject cd silexproject composer require aura/dispatcher dev-develop-2 I hope you have composer installed else get composer. I am not going to explain each and everything, the code is self explanatory. You can move the classes according to your wish (may be to another folder). I am trying to show a simple use case.