PHPackages                             schnoog/php\_atproto - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. schnoog/php\_atproto

ActiveLibrary[HTTP &amp; Networking](/categories/http)

schnoog/php\_atproto
====================

Lightweight PHP ATProto Implementation

0.0.0.7(2y ago)441MITPHP

Since Nov 5Pushed 2y ago1 watchersCompare

[ Source](https://github.com/schnoog/php_atproto)[ Packagist](https://packagist.org/packages/schnoog/php_atproto)[ Docs](https://github.com/schnoog/php_atproto)[ RSS](/packages/schnoog-php-atproto/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (7)Used By (0)

php\_atproto
============

[](#php_atproto)

A light weight implementation of the atproto protocol to have fun with Bluesky

Why?
----

[](#why)

After looking into the already available libraries to communicate with atproto I decided to go my own way. I somehow abstain from using libraries which include a dozen other libraries in their composer.json while the real communication functionality can be covered by way fewer 3rd party components.

Currently (I would call it pre-alpha) I include only one 3rd party library, namely

- "tcdent/php-restclient"

Maybe it will become more in the future.

#### V0.0.0.5 remark

[](#v0005-remark)

To make it all less of a mess, I renamed almost all functions..... You can find a list of the functions I implemented here:

[Implemented functions sorted by Endpoint.md](doc/Implemented_sorted_by_Endpoint.md)

[Implemented functions sorted by the name of the function.md](doc/Implemented_sorted_by_Funtions.md)

Installation
------------

[](#installation)

### Composer installation

[](#composer-installation)

You can install the library with composer by executing

`composer require schnoog/php_atproto`

This will install the library in the usual vendor directory. Now copy the file `/vendor/schnoog/php_atproto/src/config.dist.php`to your install directory and rename it to `config.php`

or use the following command from within your install directory to copy the file automatically (if there's alreay a file name `config.php` in the install directory it will not be overwritten.

`php -r 'if(!file_exists(__DIR__ . "/config.php"))   copy (__DIR__ . "/vendor/schnoog/php_atproto/src/config.dist.php", __DIR__ . "/config.php");'`

Change the content of the `config.php` and enter your credentials

### Package installation

[](#package-installation)

**This is the way to go if you don't have installed composer at all.**

I created a second repository which includes all files required to run this thing.

Download the zipped version from here: [Packed php\_atproto version](https://github.com/schnoog/php_atproto_packed)

Just unzip it, set your credentials in the `config.php` and you're ready to go. Yes, it's really that easy

### Manual installation

[](#manual-installation)

This means you have a copy of the whole repository either by

- Cloning from Github
- - git clone :schnoog/php\_atproto.git -&gt;your install directory&lt;-
- - git clone [https://github.com/schnoog/php\_atproto.git](https://github.com/schnoog/php_atproto.git) -&gt;your install directory&lt;-

or

- Downloading the [zip archive from Github ](https://github.com/schnoog/php_atproto/archive/refs/heads/main.zip) and extracting it to -&gt;your install directory&lt;-
-

After you have the files in your desired directory, copy the file `config.dist.php` into your install directory and rename it to `config.php`

Don't forget to install the dependency by executing `composer install`

Change the content of the `config.php` and enter your credentials

My requirements
---------------

[](#my-requirements)

I have (currently) only a few:

- Login (create auth token)
- Locally store the token
- If I call a function to f.e. post on Bluesky, I should only be required to call the functions with its' parameteres, the rest should happen behind the scenes

How does it work
----------------

[](#how--does-it-work)

I'm not the biggest fan of OOP. Not everything in my digital world has to be a class. So I'll keep the interface purely function (evenso that especially creating a post would be easier to encapsulate in a class)

What's alread there
-------------------

[](#whats-alread-there)

OK, let's check what's available

### Authentification

[](#authentification)

This small example just authentificates against the server and stores the token locally. If a local stored token is available and the last validity check was performed more than specified in `$config['atproto']['storedsession_validity']` seconds ago, the validity will be checked against the backend (in my case BlueSky)

And here a remindes for myself: Paste `if (!atp_session_get())return false; `at the beginning of the interface (post, get timeline...) functions.

```
