Manuscript

A tool to help in developing composer-based PHP packages

Please note: This has only been tested by myself on a Linux machine. It has never touched a Mac or a Windows machine. If you’d like to help test in those environments, I’d love that 🙂

Quick-start

Prerequisites

Composer

You will need composer installed globally on your local machine.

Git

Git is optional but recommended.

When running the init command, the package creation will attempt to use git to try and determine your git username and email. It does this by accessing your git global config. If values are found, they will be used as the defaults for those values when manuscript asks you to enter them.

You can still enter new values if you don’t wish to use the defaults.

Github Personal Access Token

When running the init --type=spatie command, part of the process sends a request to your GitHub account to create a new repository from the Spatie Laravel Package Template.

For that to work, you will need to enter your own Token, which you can generate following this guide. In short you head to GitHub > Settings > Developer Settings > Personal Access Tokens.

As a minimum, you should select the following scopes when generating your token: “admin:org”, “repo”.

Once you’ve entered your token during the init command, it will be saved for future use in a .manuscript file in your home directory.

Installation (Tested on Linux only)

Install this package globally. 🙂

composer global require davidpeach/composer-manuscript:^4.0

Creating a new package

Create a composer package

This command is essentially a wrapper around `composer init`.

manuscript init

# Follow the terminal instructions

Create a Laravel package (using Spatie’s skeleton template)

This command will initialize a new repository in your github account, using the excellent Laravel package skeleton by Spatie.

It will then clone it to your local machine and begin Spatie’s configure script.

manuscript init --type=spatie

# Follow the terminal instructions

Create a local Laravel installation “playground” for testing and playing.

Adding the --play command when creating your package (or in a pre-existing package), will tell manuscript to download your chosen version of Laravel and install your local package into it, using the composer path repository setting.

This will symlink your local package into that Laravel installation. Meaning you can develop your package and see the changes updated live in a full Laravel application.

Create a Laravel playground during basic init

manuscript init --play

# Follow the terminal instructions

Create a Laravel playground during Spatie skeleton package init

manuscript init --type=spatie --play

# Follow the terminal instructions

Create a Laravel playground for an existing composer package

cd /existing/composer/package/root
manuscript play

# Follow the terminal instructions

Uninstall

composer global remove davidpeach/composer-manuscript