Skip to content

A simple-ish PHP app that stores status updates as small posts in a SQLite database.

License

Notifications You must be signed in to change notification settings

oelna/microblog

Repository files navigation

Mini Microblog

A simple PHP app that stores Twitter-like status updates in a sqlite database. It also generates a JSON feed, that can be used as a source for the Micro.Blog service. It is aimed at people who would like to host their own micro.blog, but want to avoid using Wordpress for it.

The app supports crossposting to Bluesky and also acts as a member of the Fediverse, in that eg. Mastodon/ActivityPub users can follow and like status updates.

a screenshot of the microblog app

There is a timeline view of your own posts, as well as a simple 'compose post' page behind a login form. Right now, only a unique ID, the post content and creation timestamp, edit time and delete status are saved for each entry, so this is only suitable for one user.

The entire design is in a directory inside a /css/ (eg. microblog/microblog.css) and can be modified easily. The site HTML is pretty straightforward and should be easy to style from the /templates/ and /snippets/ directories.

ATOM and JSON feeds are provided and rerendered as static files when posting.

If the PHP version on the server supports it, an XML-RPC interface is provided to enable posting from external apps, such as Marsedit. Please set an app_token in config.php as secret to use with your username. If you don't set one, you have to use your login password to authenticate. You can use the metaWeblog API, that is discovered automatically, or add a Micro.Blog account and point it to your site. As a bonus, you can schedule posts this way, if you set the creation date in the future ;)

The app requires at least PHP 7.2 and was tested on 8.1. It needs mbstring, curl, sqlite and openssl modules.

Installation

  • copy (or clone) the files to a directory on your webserver
  • have them accessible from the domain (or subdomain) root /
  • for Apache: edit .htaccess and set RewriteBase to a path matching your installation directory
  • for nginx: have a rule similar to try_files $uri $uri/ /index.php?$args; for the microblog-location
  • open the website in the browser, it should take you to the site settings page and prompt you to enter a password, or set up a passkey

Optional

  • modify the theme file microblog.css
  • do more configuration under /settings, eg. fill in ActivityPub and Bluesky info
  • set an app_token to use with XML-RPC
  • setup a Passkey to log in with

To Do

  • test whether the ping function actually works
  • improve html rendering (?)
  • unify autolink regexes of atprotocol.php and autolink.php
  • support file attachments (started! can attach images to posts and remove them)
  • see issues

Support my work

The app is provided for free, but if you'd like to support what I do, please consider tipping or sponsoring – it is greatly appreciated. Can't promise it'll buy you software support, but if you send a reasonable PR, I'm happy to accept improvements to the app. Links are under GitHub's official sponsor button.