Skip to content

Commit 02f1c21

Browse files
author
Teppo Koivula
committed
Add proper README and bump version to 1.0.0
1 parent 50b3688 commit 02f1c21

File tree

2 files changed

+65
-4
lines changed

2 files changed

+65
-4
lines changed

README.md

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,68 @@
1-
# ProcessWire Composer installers
1+
# ProcessWire Composer Installer
22

3-
This project contains [Composer custom installers](https://getcomposer.org/doc/articles/custom-installers.md) for
4-
ProcessWire CMS/CMF modules and site profiles.
3+
This project contains [Composer custom installers](https://getcomposer.org/doc/articles/custom-installers.md) for ProcessWire CMS/CMF modules and site profiles.
4+
5+
## What does it do and why do we need it?
6+
7+
By default Composer installs all packages into the /vendor/ directory. This is great for things that support this type of structure, but not so great for projects – such as ProcessWire – that expect things to be in specific location: modules in /site/modules/module-name/, and site profiles generally as the /site/ directory itself, /site-profile-name/ when the system hasn't been installed yet, or before installat/site-subsite-name/ in the case of native multisite support.
8+
9+
ProcessWire Composer Installer currently makes two "corrections" to packages that define it as a dependency in their composer.json files:
10+
11+
- **modules** are installed under `./site/modules/ModuleName/` (module name is read from composer.json and converted to PascalCase)
12+
- **site profiles** are installed under `./site-profile-name/` (site profile name is read from composer.json and the site- prefix is added automatically if needed)
13+
14+
## Site-specific modules supports
15+
16+
One more thing to note is that modules can be installed either from the root directory of the ProcessWire installation, or from the `/site/` directory itself. Installer will automatically determine which location you're currently in, and adjust paths accordingly.
17+
18+
This way we can install modules on a per-site basis (in the case of multisite), or include Composer based module dependencies with a site profile (which would otherwise require manual modifications to the ProcessWire root directory composer.json file, or at least running `composer require` in the root directory for said dependencies.)
19+
20+
## Alternatively...
21+
22+
There's a very similar project you might've heard of, called `hari/pw-module`. While this project and Hari's ProcessWire module installer are similar, there are a few key differences:
23+
24+
- This project allows you to install both modules *and* site profiles
25+
- This project allows you to install modules from the /site/ directory
26+
- This project provides some additional features (and composer.json options) in terms of module and site profile naming, and also includes additional rules for auto-formatting module and site profile directory names
27+
28+
## Usage
29+
30+
### For developers installing modules or site profiles
31+
32+
- To add a new module from Packagist, run `composer require vendor-name/module-name` in either ProcessWire root directory, or your /site/ directory.
33+
- To add a new site profile from Packagist, run `composer require vendor-name/site-profile-name` in the ProcessWire root directory.
34+
35+
*Note that in order for this work, the module or site profile in question has to have `wireframe-framework/processwire-composer-installer` as a dependency. See next section for instructions for module or site profile authors.*
36+
37+
### For module or site profile authors
38+
39+
The usage of this project is rather simple. You just need to a) add `wireframe-framework/processwire-composer-installer` as a dependency to your project by manually modifying the composer.json file or by running `composer require wireframe-framework/processwire-composer-installer` in your module or site profile root directory, and b) define the type of your package (via composer.json) as `pw-module` (for modules) or `pw-site-profile` (for site profiles).
40+
41+
Here's a stripped-down sample composer.json for a module:
42+
43+
```
44+
{
45+
"name": "vendor-name/module-name",
46+
"type": "pw-module",
47+
"require": {
48+
"wireframe-framework/processwire-composer-installer": "^1.0.0"
49+
}
50+
}
51+
```
52+
53+
And here's an equally stripped-down sample composer.json for a site profile:
54+
55+
```
56+
{
57+
"name": "vendor-name/site-profile-name",
58+
"type": "pw-site-profile",
59+
"require": {
60+
"wireframe-framework/processwire-composer-installer": "^1.0.0"
61+
}
62+
}
63+
```
64+
65+
*In order for your modules to be easily installed, you should also add them to Packagist: https://packagist.org/.*
566

667
## Requirements
768

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "composer-plugin",
44
"description": "Custom Composer installer for the ProcessWire CMS/CMF modules and site profiles.",
55
"keywords": [ "composer", "processwire", "installer" ],
6-
"homepage": "https://wireframe-framework.com",
6+
"homepage": "https://wireframe-framework.com/docs/processwire-composer-installer/",
77
"license": "MPL-2.0",
88
"authors": [
99
{

0 commit comments

Comments
 (0)