https://github.com/theimpossibleastronaut/writeas.php
Basic implementation of the write.as / write.freely api in PHP
https://github.com/theimpossibleastronaut/writeas.php
api api-client php writeas writefreely
Last synced: 3 months ago
JSON representation
Basic implementation of the write.as / write.freely api in PHP
- Host: GitHub
- URL: https://github.com/theimpossibleastronaut/writeas.php
- Owner: theimpossibleastronaut
- License: mit
- Created: 2020-05-05T17:04:36.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-06-07T13:44:31.000Z (almost 5 years ago)
- Last Synced: 2024-04-26T13:46:35.006Z (about 1 year ago)
- Topics: api, api-client, php, writeas, writefreely
- Language: PHP
- Size: 41 KB
- Stars: 9
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README


[](https://packagist.org/packages/theimpossibleastronaut/write.as)
[](https://packagist.org/packages/theimpossibleastronaut/write.as)
[](https://packagist.org/packages/theimpossibleastronaut/write.as)# writeas.php
Implementation of the write.as API in PHP.It's very basic, and PHP 7.x oriented, but should work on most versions as it's
only clear dependency is curl.```php
body = "Hello from Writeas.php";
$post->save();
```The Context is your livelyhood for communicating with the instance you specify in its constructor. It handles the building of requests and updating of object instances.
If you work with Anonymous data like Posts, it's important that you save the returned token that you get after initially saving your Post (otherwise you'll be unable to update the post).
Objects like Post or Collection will update automagically after calling a save/get function. For instance, if you ->save a Post, it's token will appear in ->token.
Authentication is done on the Context (use multiple contexts if you want to authenticate multiple users). Upon logging in you should store the access token for future sessions. Logout when needed, and don't keep tokens lying around.
All errors are transformed to catchable WAException objects.
# Supports the following api endpoints (near) completely
- [x] Authentication
- [x] Posts
- [x] Collections
- [x] Users
- [x] Channels