Posting to Bluesky via the API from PHP – Part Five – Putting it all Together

In this series of posts we have looked at:

In this final post we are looking at putting it all together. This includes a worked example plus a complete library of functions that will allow you to easily interact with the Bluesky API.

The Prerequisites

What this project has predominately been about is the correct formatting of the parameters that need to be passed to the Bluesky API. This code does not directly call the API but uses BlueskyApi by Clark Rasmussen to do that.

Here’s … Read the rest

Posting to Bluesky via the API from PHP – Part Four – Link Cards

In this we post we are continuing to look at accessing Bluesky from the API via PHP. Previously we looked at making a connection to Bluesky, posting text, images and handling links and in this post we take a look at Link Cards.

What Even IS a Link Card?

Link Cards are the snippets of a website that is linked to a post that you will no doubt be familiar with seeing elsewhere. Typically, elsewhere these are handled for you but not in Bluesky – here you do all the heavy lifting.

Example of a Link Card

Fetching Details

Read the rest

Posting to Bluesky via the API from PHP – Part Three – Links

So far we have looked at making a connection to Bluesky, posting text and images. In this post I want to look at how links are handled. Unlike X and Mastodon on Bluesky when you post text that includes one or more links these are not parsed and activated. You have to tell Bluesky that you have links in your text and where they are.

Parsing for Links

In order for links to be handled correctly by Bluesky in addition to the text itself you also need to pass an array as part of the parameters giving the start … Read the rest

Posting to Bluesky via the API from PHP – Part Two – Images

In the first of these posts we looked at creating the connection to the Bluesky API and posting a text post. In this second post we are going to extend that out to post images as well as text.

The code posted here are snippets from a larger library of functions that you can drop in and use to post to Bluesky. If some parts look more complex than they need to all will be revealed in the final version.

Uploading Images

In order to post an image to Bluesky you have to take a few steps:

  1. open and ingest
Read the rest

Posting to Bluesky via the API from PHP – Part One

With all the uncertainty surrounding the future of X (née Twitter), I decided to take a look at Bluesky which somewhat ironically has its roots in Twitter where it was started as an internal project. Bluesky is still in beta and is invite-only. I worry about its long-term given that ultimately it too has to make money, something that Twitter has singularly failed to do. None of this, of course, affects the topic today which is posting to Bluesky via the API.

Basic Concepts

The first thing to say is that I am using the following library to actually post … Read the rest

Sending messages to Pushover from PHP

One of the things that I regularly bake into my own applications is notifications of when things go really bad and need my immediate attention. For this, I use the excellent and simple Pushover service which allows me to send a push notification to my mobile device. In this post, I run through how to set up your application in Pushover and then send a notification via PHP.

Setup Pushover

I am assuming that you have already created your Pushover account. You get a 30-day trial and after that, it is just $5 as a one-off purchase.

From your dashboard … Read the rest

Changing the Default PHP Version in MAMP

When doing any development on my laptop I use the very useful MAMP to give me an xAMP (Apache, MySQL & PHP) environment.

I recently upgraded and found that the free version offers two versions of PHP: 7.4.33 and 8.2.0 which would be fine but my production server is still on 8.1 and so I needed to match that. I could have upgraded to MAMP Pro but £90 just to switch to PHP 8.1 seemed a bit much, although, I do appreciate that by doing so I would be supporting the developers.

Changing the PHP Versions in MAMP Free Edition

Read the rest

Setting the Codeigniter Environment for both CLI and Browser

I’ve recently been getting to grips with the Codeigniter framework after years of using a home-grown monstrosity. I was becoming more and more concerned about the level of security in my own framework and decided I would be better off with something that’s maintained.

I researched the many PHP frameworks to find one that was going to work for me. I toyed with the idea of using Symfony, which is what our products are based on, but the time to get up-to-speed with it was greater than I wanted to invest. I therefore settled on Codeigniter which looked easier … Read the rest

Using Google Translate to Automatically Translate a Symfony Language File

Recently the company I work for launched a new version of our product with multi-language capabilities. This was great for us but when we wanted to expand out to other languages we found that it was expensive to have the file translated.

Given that our language file is in a standard format (Symfony’s message YML format) we wondered if it would be possible to convert the file automatically via Google Translate and then give it to a translator to polish. It turns out that it is and this is quicker and cheaper than having all the file translated … Read the rest

Raspberry Pi GPS tracker – Connecting Without a Network

All articles to date have been about getting the GPS working with the Raspberry Pi and converting the original Python code to PHP. All of this works well (for me) but what if you want to make changes to the settings or download the log file while you are out and about and away from your home network?

Normally what happens is that you configure your device to connect to a known network but as you are going to be using the GPS/Pi combination away from known networks you need a way to access anywhere without having to connect a … Read the rest