Download the PHP package schnoog/php_atproto without Composer

On this page you can find all versions of the php package schnoog/php_atproto. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php_atproto

php_atproto

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

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

Maybe it will become more in the future.

V0.0.0.5 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

Implemented functions sorted by the name of the function.md

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

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

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

Manual installation

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

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

I have (currently) only a few:

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

OK, let's check what's available

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.

Posting (into the own timeline)

Yes, this thing actually can post into the own timeline. All you need to do (after including the includer.php) is calling the function.

But this comes with limitations (as everything on earth):

Here's a little bit about the parameters for the main function atp_create_post

$text = "This is the text to post, \n containing mentioning @develobot.bsky.social and a link https://github.com/schnoog/php_atproto";

$lang = ['de','en'];

$add_mentions_facets = true;

$images = [ __DIR__ . "/pic01.jpg" , __DIR__ . "/pic02.jpg"];

$images_alts = [ '', 'Alt text for second image'];

As mentioned before, you can either have images or a webcard. If you defined both (and provide the function with them ;) ), only the webcard will be displayed

$website_uri = "https://github.com/schnoog/php_atproto";

$website_title = "My user defined title";

$website_description = "My user defined description";

$website_image = __DIR__ . "/website_image.png";

OK, let's look how some calls you be done

Reading the own timeline

Yes, also reading the own timeline (or feed or however it's called) is also quite easy. Tbh, the most easiest thing available

Search posts

This function is somehow limited. I'm currently unable to receive any valid result from app.bsky.feed.searchPosts. So instead I'm reading from https://search.bsky.social/search/posts

Not nice, but it works however

More info

I'll create a list with the functions and endpoints implemented and will try to keep it up to date.

Implemented_sorted_by_Endpoint.md

Implemented_sorted_by_Funtions.md


All versions of php_atproto with dependencies

PHP Build Version
Package Version
Requires tcdent/php-restclient Version 0.1.8.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package schnoog/php_atproto contains the following files

Loading the files please wait ....