PHPackages                             dannyweeks/mersey - 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. [CLI &amp; Console](/categories/cli)
4. /
5. dannyweeks/mersey

ActiveProject[CLI &amp; Console](/categories/cli)

dannyweeks/mersey
=================

Establish ssh connections to quickly to any registered servers.

v2.1.0(9y ago)546[3 issues](https://github.com/dannyweeks/mersey/issues)MITPHP

Since Oct 14Pushed 8y ago2 watchersCompare

[ Source](https://github.com/dannyweeks/mersey)[ Packagist](https://packagist.org/packages/dannyweeks/mersey)[ RSS](/packages/dannyweeks-mersey/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (5)Dependencies (11)Versions (9)Used By (0)

Mersey
======

[](#mersey)

[![Build Status](https://camo.githubusercontent.com/4d59928a8778011ad2b4f12ccc80933c70b696150babf269013bed4cfaab9061/68747470733a2f2f7472617669732d63692e6f72672f64616e6e797765656b732f6d65727365792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/dannyweeks/mersey)[![Codacy Badge](https://camo.githubusercontent.com/a457ba3128dc4298580520ee98db7220d92f402c5ebaa6e220a6d2a53783bad6/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f6531663730373730623030383438653662303632316533616330313162393330)](https://www.codacy.com/app/danny_4/mersey)

A command line (CLI) tool written in PHP to simplify establishing/interacting an SSH connection to multiple servers quickly.

Some cool things you can do:

- [Connect to servers.](#connecting-to-a-server)
- [Connect to a server and got to a projects directory.](#go-to-a-project)
- [Connect to a server and run a script of your choice.](#run-a-script)

I also wrote a blog [post](http://dannyweeks.com/blog/2015/11/19/introducing-mersey-a-server-management-tool/) when Mersey was first released you might find interesting.

[Upgrading from Mersey v1 to v2?](#upgrading-to-version-2)

Prerequisites
-------------

[](#prerequisites)

- OS X is the only supported operating system but Linux should be fine!.
- [Composer](https://getcomposer.org/).

Installation
------------

[](#installation)

If it isn't already, add composers bin directory to your PATH by adding the below to your ~/.bash\_profile (or ~/.bashrc).

```
export PATH=~/.composer/vendor/bin:$PATH
```

Now, install Mersey globally so you have access to it anywhere by running

```
composer global require dannyweeks/mersey
```

Initialise Mersey. This creates a hidden directory in your home to store your servers.

```
~/.composer/vendor/dannyweeks/mersey/init.sh
```

Your servers are loaded via a json file which is located `~/.mersey/servers.json`. It comes populated with some example servers to help you on your way. Read the [Defining Servers](#defining-servers) section for more information.

Assumptions/Default Settings
----------------------------

[](#assumptionsdefault-settings)

Mersey assumes your SSH key is stored `~/.ssh/id_rsa`.

Mersey uses port 22 to connect the server.

However, these can be [set manually](#additional-server-settings) on a per server basis.

Usage
-----

[](#usage)

Below are the commands to interact with the `mersey` tool.

DescriptionCommandOptions/NotesAdd a server to the config`mersey add`Interactive questionsEdit the server config`mersey edit`Opens in default text editorEdit global scripts`mersey scripts`Opens in default text editorPing servers and show results`mersey ping`Connect to a server`mersey  `-f/--force Skip reachable test. -p/--projects List projectsGo to a project`mersey  `-f/--force Skip reachable test. -s/--scripts List scriptsRun a script`mersey   `-f/--force Skip reachable test.Defining Servers
----------------

[](#defining-servers)

There is a small amount of setting required to get up and running. Each server is an object in a json array. A server object needs a minimum of the following:

- **name**: The alias of the server which will be used on the command line.
- **displayName**: The name of the server.
- **username**: The username used to logon of which the SSH key is associated with.
- **hostname**: The IP address or domain name of the server.

You can get started by running `mersey add` which will ask a series of questions and then add the defined server to your config file.

*servers.json*

```
[
    {
        "name": "personal",
        "displayName": "Personal Server",
        "username": "danny",
        "hostname": "192.168.0.1"
    }
]
```

### Additional Server Settings

[](#additional-server-settings)

There are optional setting for servers which help facilitate your needs.

- **sshKey**: Use this private key to connect rather than the default.
- **port**: Use this port to make connections instead of the default for this server.
- **projects**: An array of project objects. [Read more in the projects section](#projects)

*servers.json*

```
[
    {
        ...
        "sshKey": "/path/to/another/id_rsa",
        "port": 2222,
        ...
    }
]
```

### Projects

[](#projects)

Add a project to a server by creating an object in the `projects` array of the server.

- **name**: The alias of the project which will be used on the command line.
- **root**: Location of the project root on the server.
- **scripts**: An array of objects. (Optional) [See Scripts](#scripts)

*servers.json*

```
[
    {
        ...
        "projects": [
            {
                "name": "project",
                "root": "/var/www/project",
                "scripts": []
            }
        ],
        ...
    }
]
```

### Scripts

[](#scripts)

Scripts are a way of running a command on a project and then exiting the session. They can be defined in two ways; either on a per project basis or globally.

A script object contains three required properties:

- **name** : The alias of the script which will be used on the command line.
- **description** : A brief description for use in Mersey.
- **command** : The command to be run on the server.

Before the command you define is ran mersey connects to the server and changes directory to the project's root.

An example of a script object would be:

```
{
    "name": "pull",
    "description": "Pulls the latest changes from git.",
    "command": "git fetch --all; git reset --hard origin/master"
}
```

#### Per Project

[](#per-project)

A script can be defined on a project by adding it to the project's `scripts` array.

*servers.json*

```
[
    {
        ...
        "projects": [
            {
                "name": "project",
                "root": "/var/www/project",
                "scripts": [
                    {
                        "name": "pull",
                        "description": "Pulls the latest changes from git.",
                        "command": "git fetch --all; git reset --hard origin/master"
                    }
                ]
            }
        ],
        ...
    }
]
```

#### Global Scripts

[](#global-scripts)

Global scripts are defined in their own file: `~/.mersey/scripts.json`. Global scripts can be run on any project.

The `scripts.json` must be a json array containing script objects.

*scripts.json*

```
[
    {
        "name": "pull",
        "description": "Pulls the latest changes from git.",
        "command": "git fetch --all; git reset --hard origin/master"
    }
]
```

### Full Example Server Definition.

[](#full-example-server-definition)

Below is a an example of a server called `personal` with one project called `project`. `project` has a script attached to it called `clean`.

```
[
    {
        "name": "personal",
        "displayName": "Personal Server",
        "username": "danny",
        "hostname": "192.168.0.1",
        "sshKey": "/path/to/another/id_rsa",
        "port": 2222,
        "projects": [
            {
                "name": "project",
                "root": "/var/www/project",
                "scripts": [
                    {
                        "name": "clean",
                        "description": "Empty the log.",
                        "command": "cat /dev/null > /var/www/project/project.log"
                    }
                ]
            }
        ]
    }
]
```

Upgrade Guide
-------------

[](#upgrade-guide)

### Upgrading To Version 2

[](#upgrading-to-version-2)

*Update Mersey via Composer.*

`composer global require dannyweeks/mersey:^2`

*Create global scripts file.*

`cp -i ~/.composer/vendor/dannyweeks/mersey/scripts.json.example ~/.mersey/scripts.json`

*Convert project scripts to objects.*

The way scripts are defined has changed therefore must be updated `open ~/.mersey/servers.json`. See the scripts [per project](#per-project) section for more details.

Contributing
------------

[](#contributing)

All [pull requests](https://github.com/dannyweeks/mersey/pulls) and bug fixes are welcomed. Please check the [CONTRIBUTING](https://github.com/dannyweeks/mersey/blob/master/CONTRIBUTING.md) file for more information.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance8

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~101 days

Recently: every ~126 days

Total

6

Last Release

3408d ago

Major Versions

v1.1.1 → v2.0.02016-03-29

### Community

Maintainers

![](https://www.gravatar.com/avatar/c09e84a218791021e234bd67e0a03ed0183747a46e2930c60358c576a707b6d8?d=identicon)[dannyweeks](/maintainers/dannyweeks)

---

Top Contributors

[![dannyweeks](https://avatars.githubusercontent.com/u/4365775?v=4)](https://github.com/dannyweeks "dannyweeks (73 commits)")

---

Tags

clissh

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dannyweeks-mersey/health.svg)

```
[![Health](https://phpackages.com/badges/dannyweeks-mersey/health.svg)](https://phpackages.com/packages/dannyweeks-mersey)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k95.4M306](/packages/laravel-horizon)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M200](/packages/laravel-ai)[illuminate/database

The Illuminate Database package.

2.8k54.9M11.7k](/packages/illuminate-database)[illuminate/console

The Illuminate Console package.

13046.0M6.5k](/packages/illuminate-console)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
