Goto navigation

shpub - micropub client for your shell

Command line micropub client written in PHP.


shpub is released as self-contained .phar file that includes all dependencies.

Download the latest release:

  • 0.7.0, 2018-02-05
    • shpub-0.7.0.phar, 566 kiB
      SHA256: f2725d076a46f3dc2501cbea809f4144b0329e0e7e00c6afbd6022be34ac3a02

See shpub downloads page for all released versions.


After downloading shpub-x.y.z.phar, you can either use it directly:

$ php /path/to/shpub-x.y.z.phar --version

or make it more easily accessible:

$ mv /path/to/shpub-x.y.z.phar /usr/local/bin/shpub
$ chmod +x /usr/local/bin/shpub
$ shpub --version

You might need sudo to be able to copy it into the /usr/local/bin/ directory.

If you're running from the git checkout, start it as follows:

$ ./bin/shpub.php --version


When using the git version, you need to have the following dependencies installed on your system:

Initial setup

$ shpub connect http://mywebsite

In case there are multiple users on the same server:

$ shpub connect http://sharedwebsite http://shareswebsite/user

If you pass a third parameter, then that will be the name of the connection. You can select a specific server/connection with -s on all commands.

List configured servers/connections

$ shpub server

Also try server -v which lists server and user URLs.

Post creation

shpub has support for the following post types:

By default shpub sends data form-encoded. To send JSON requests, use the --json option.

Create a like

$ shpub like
Like created at server

Create a reply

$ shpub reply "Hey, cool!"
Reply created at server

Create a note

A normal note:

$ shpub note "oh this is cool!"
Note created at server

Note with an image:

$ shpub note -f image.jpg "this is so cute"
Note created at server

You can use -f several times to upload multiple files.

URL image upload:

$ shpub note -f "img url!"
Note created at server

Load note content from a file:

$ shpub note - < /path/to/file.txt
Note created at server

Custom post types

You may create custom post types with the x command. This is useful if your micropub endpoint supports additional types, like known's "annotation" type (comments and likes for posts).

Create a comment to a known post:

$ shpub x annotation\
    -x url=http://known.bogo/2016/example-domain-1\
    -x type=reply\
    -x username=barryf\
    -x userurl=\
    -x userphoto=\
    -x content="There is a typo in paragraph 1. 'Fou' should be 'Foo'"


You may delete and restore posts on micropub servers:

$ shpub delete http://known.bogo/2016/like

Restore a deleted post:

$ shpub undelete http://known.bogo/2016/like


Existing posts can be modified if the server supports this:

$ ./bin/shpub update --add category=foo category=bar\
                     --replace slug=differentslug\
                     --delete category=oldcat\

Syndication targets

You may list the syndication targets defined on the server:

$ shpub targets

Then specify it when creating a post:

$ shpub article -x mp-syndicate-to= title text

File uploads

Most post types allow file uploads. Simply use -f:

$ shpub note -f path/to/image.jpg "image test"
Note created at server

The media endpoint is used automatically if the micropub endpoint has one. To force shpub to directly upload the file and skip the media endpoint, use the --direct-upload option:

$ shpub note --direct-upload -f path/to/image.jpg "direct upload"

Use the upload command to upload files to the media endpoint without creating a post:

$ shpub upload /path/to/file.jpg /path/to/file2.jpg
Uploaded file /path/to/file.jpg
Uploaded file /path/to/file2.jpg


To debug shpub or your micropub endpoint, use the --debug option to see curl command equivalents to the shpub HTTP requests:

$ shpub -s known -d note "a simple note"
curl -X POST -H 'User-Agent: shpub' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Authorization: Bearer abc' -d 'h=entry' -d 'content=a simple note' 'http://known.bogo/micropub/endpoint'
Post created at server

See curl commands only

You may use the --dry-run option to make shpub not send any modifying HTTP requests (e.g. POST and PUT).

Together with --debug you can use this to get curl commands without sending anything to the server:

$ shpub --debug --dry-run like
curl -X POST -H 'User-Agent: shpub' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Authorization: Bearer cafe' -d 'h=entry' -d 'like-of=' 'http://anoweco.bogo/micropub.php'
Like created at server


Releasing a new version

  1. Add notes to ChangeLog
  2. Update version number in build.xml and src/shpub/Cli.php
  3. Run phing
  4. Commit and tag the version
  5. In the directory, run ./scripts/

About shpub

shpub's homepage is

Source code

shpub's source code is available from or the mirror on github.


shpub is licensed under the AGPL v3 or later.


shpub was written by Christian Weiske.

File: shpub.htm | last update: 2018-02-21 21:38:27 Valid XHTML Valid CSS