Dean151 / Aln-Symfony

A pure PHP Symfony implementation to replace alnpet.com API
3 stars 2 forks source link

Aln-Symfony

Aln-Symfony is a replacement for the Aln original API powering pet feeding machines.

It is a pure PHP Symfony implementation of my legacy Aln-NodeJs implementation. It relies heavily on tests to prevent regressions.

This API is hosted on http://api.feedmypet.app. Please use it with your machine if you feel to!

Why?

Because the original API is not secure, not maintained, and as of the latest news, is offline.

How?

When the original (not-secured) API was still alive, I was able to use it to reverse engineer the whole set of communications between my pet feeding machine, and their server. Then, I could spoof their connection to my server, and make my machine communicate with only my server

Usage

You will find a hosted version of this server that you can use for your machine without self-hosting the code if you want:

Above, you'll also find a Swagger UI that will document available endpoints, responses and body requirements for each of them.

Create a user

Please note that POST user/register will send a reset password mail if the email already exists (see below)

Login with email (a.k.a for password reset)

Please note that POST user/reset will sent a 200 response code even if the email does not exists.

Login with password

Configure your feeder

Before anything, you need to configure your feeder to communicate with our API.

Associate your feeder with your account

Manage your feeder

Test

Tests run using a Docker environment:

Deploy your own self-hosted api

Requirements

Deploy your own

Generate a secret, see https://stackoverflow.com/questions/60837428/symfony-terminal-command-to-generate-a-new-app-secret

APP_SECRET=

Configure your mysql database

is either mysql (e.g. 5.7) or mariadb (mariadb-10.11.4)

DATABASE_URL="mysql://user>:<password>@<host:/?serverVersion=&charset=utf8mb4"

Configure RabbitMQ

RABBITMQ_HOST=127.0.0.1 RABBITMQ_PORT=5672 RABBITMQ_USERNAME=guest RABBITMQ_PASSWORD=guest


- Install dependencies:
```shell
composer install --optimize-autoloader

Now you can follow the steps for configuring your feeder above, and use it. If you do not enable authentication, you can skip all the authentication steps and use your feeder directly!