PHPackages                             yourls/composer-installer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. yourls/composer-installer

AbandonedArchivedComposer-plugin[Utility &amp; Helpers](/categories/utility)

yourls/composer-installer
=========================

YOURLS' custom Composer installer for YOURLS plugins

1.1(5y ago)2171[1 PRs](https://github.com/YOURLS/composer-installer/pulls)2MITPHPCI failing

Since Jun 10Pushed 4y ago1 watchersCompare

[ Source](https://github.com/YOURLS/composer-installer)[ Packagist](https://packagist.org/packages/yourls/composer-installer)[ Docs](https://github.com/yourls/composer-installer)[ GitHub Sponsors](https://github.com/LeoColomb)[ GitHub Sponsors](https://github.com/ozh)[ RSS](/packages/yourls-composer-installer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (5)Versions (5)Used By (2)

YOURLS Composer Installer [![Listed in Awesome YOURLS!](https://camo.githubusercontent.com/34094d1c9744dec407f30c4b523746f7e4a3f1607e176b83083b5d532b81c74c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f417765736f6d652d594f55524c532d433541334245)](https://github.com/YOURLS/awesome-yourls/)
=============================================================================================================================================================================================================================================================================================================

[](#yourls-composer-installer-)

[![](https://user-images.githubusercontent.com/223647/84647720-18dba800-af04-11ea-9e7f-c6d623050f4a.png)](https://user-images.githubusercontent.com/223647/84647720-18dba800-af04-11ea-9e7f-c6d623050f4a.png)

> Keep track of plugins and custom packages added with Composer in a `user/composer.json` file that is left untouched when you update YOURLS.

> In a nutshell: `composer add-plugin joecool/super-yourls-plugin`

#### 🚧 Work in progress.

[](#construction--work-in-progress)

[![Build Status](https://camo.githubusercontent.com/cde9a1b1482b22f5f30657a310fc2987af90054a7532f85dc3041d46001b4fbb/68747470733a2f2f7472617669732d63692e636f6d2f594f55524c532f636f6d706f7365722d696e7374616c6c65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/YOURLS/composer-installer) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/9de55661e58118c8d9e1c50d1cb1880bb6dcc95c42e29740129ccbf288038b98/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f594f55524c532f636f6d706f7365722d696e7374616c6c65722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/YOURLS/composer-installer/?branch=master) [![Code Coverage](https://camo.githubusercontent.com/6df5c9d2568f20145a926b96283ca28cbc7202da216d939d104156e3735403c0/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f594f55524c532f636f6d706f7365722d696e7374616c6c65722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/YOURLS/composer-installer/?branch=master) [![Packagist](https://camo.githubusercontent.com/a4ed12a32b9aca05553b52044d2c3ba79c3dfd7c49fc845323f9164af6c81e44/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f796f75726c732f636f6d706f7365722d696e7374616c6c65722e737667)](https://packagist.org/packages/yourls/composer-installer)

#### Foreword : install YOURLS with Composer

[](#foreword--install-yourls-with-composer)

Installing YOURLS with Composer is already possible out of the box and doesn't need anything special. Just do :

```
$> composer create-project yourls/yourls path/to/install
```

(For instance `composer create-project yourls/yourls .` in an empty directory)

Note that this merely *downloads* the [latest YOURLS release](https://github.com/YOURLS/YOURLS/releases) in the specified directory. You will need after this to properly *install* YOURLS (see [yourls.org/#Install](https://yourls.org/#Install))

Install plugins
---------------

[](#install-plugins)

As a user you simply need to `require` the plugin in your `user/composer.json`.

```
{
    "require": {
        "joecool/super-plugin": "^1.0"
    }
}
```

Even easier, in the command line, just type:

```
$> composer add-plugin joecool/superplugin
```

This will download the plugin into `user/plugins/superplugin` , and transparently install any dependency in YOURLS' `vendor` directory.

This specific YOURLS plugin itself needs to be listed on [Packagist](https://packagist.org/). If it's not the case, nag your favorite plugin coder so they get it listed. *Even better*, open a simple Pull Request on their repository to help them doing so: see below.

##### 💡 Try it yourself:

[](#bulb-try-it-yourself)

```
$> composer add-plugin ozh/example-plugin

```

Make YOURLS plugins compatible
------------------------------

[](#make-yourls-plugins-compatible)

As a plugin coder, this is a simple 2 steps operation: add a `composer.json` and get your plugin listed on [Packagist](https://packagist.org/). That's it.

### 1. Add a `composer.json` to your plugin

[](#1-add-a-composerjson-to-your-plugin)

First, your plugin must require PHP 7.2+

The `composer.json` tells everything Composer needs to know about your plugin. The important bits are `"type": "yourls-plugin"` and `"require"` this installer `"yourls/composer-installer"` as a dependency

A minimalist `composer.json` would be for example:

```
{
    "name": "ozh/example-plugin",
    "description": "Example of a YOURLS plugin installable with Composer",
    "type": "yourls-plugin", //
