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.6.0, 2017-11-13
    • shpub-0.6.0.phar, 564 kiB
      SHA256: d7093f98bb76872132216ac46dc532aa6819ac88844c7e81e374ab84a6b90ad2

See shpub downloads page for all released versions.


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

Initial setup

$ ./bin/shpub.php connect http://mywebsite

Different user:

$ ./bin/shpub.php connect http://mywebsite http://mywebsite/user

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

List configured servers/connections

$ ./bin/shpub.php server

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

Post creation

shpub has support for the following post types:

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

Create a like

$ ./bin/shpub.php like
Like created at server

Create a reply

$ ./bin/shpub.php reply "Hey, cool!"
Reply created at server

Create a note

A normal note:

$ ./bin/shpub.php note "oh this is cool!"
Note created at server

Note with an image:

$ ./bin/shpub.php 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:

$ ./bin/shpub.php note -f "img url!"
Note created at server

Load note content from a file:

$ ./bin/shpub.php 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:

$ ./bin/shpub.php 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:

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

Restore a deleted post:

$ ./bin/shpub.php 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:

$ ./bin/shpub.php targets

Then specify it when creating a post:

$ ./bin/shpub.php article -x mp-syndicate-to= title text

File uploads

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

$ ./bin/shpub.php 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:

$ ./bin/shpub.php 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:

$ ./bin/shpub.php 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:

$ ./bin/shpub.php -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

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-01-21 13:03:04 Valid XHTML Valid CSS