Download the PHP package fundevogel/php-mastodon without Composer
On this page you can find all versions of the php package fundevogel/php-mastodon. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fundevogel/php-mastodon
More information about fundevogel/php-mastodon
Files in fundevogel/php-mastodon
Package php-mastodon
Short Description A small PHP library for interacting with Mastodon's REST API.
License GPL-3.0
Homepage https://fundevogel.de
Informations about the package php-mastodon
php-mastodon
A small PHP library for interacting with Mastodon's REST API. Its documentation can be found here.
Note: Before you get started, be sure to create an application (under "Development" in your profile settings) first.
Getting started
Install this package with Composer:
To get an idea how you could implement this, have a look at these examples:
Note: In most cases, using $api->logIn()
will be enough. You may then view other people's statuses, etc as well as your own by providing your account ID as parameter as shown above.
.. but I need more docs!
First, have a look at the docs.
Now, all API methods match their URL counterparts:
mastodon.example/api/v1/accounts/:id
becomes$api->accounts()->get($id)
mastodon.example/api/v1/accounts/:id/statuses
becomes$api->accounts()->statuses($id)
mastodon.example/api/v1/timelines/home
becomes$api->timelines()->home()
mastodon.example/api/v1/statuses/:id
becomes$api->statuses()->get($id)
.. same goes for the resulting API entities you get back. For example, the Status
entity methods match their array counterparts as found in the docs (only camelcased):
id
may be accessed with$status->id()
created_at
may be accessed with$status->createdAt()
account
may be accessed with$status->account()
(which in turn gives anAccount
entity)
Roadmap
- [ ] Add tests
- [x] Add authentication helpers
- [x] Return API entities as individual classes
- [ ] Add missing API methods:
- timelines/streaming
- notifications/push
- search
- admin
- [ ] Add missing API entities:
- admin/account
- admin/report
- [ ] Update empty API entities:
- error
- pushsubscription
- report
- scheduledstatus
Happy coding!