locomotivemtl / o6c-api
There is no license information available for the latest version (dev-master) of this package.
dev-master
2020-05-01 16:46 UTC
Requires
- php: >7.2
- ext-pdo: *
- lcobucci/jwt: ^3.3
- middlewares/client-ip: ^2.0
- pimple/pimple: ^3.3
- slim/psr7: ^1.0
- slim/slim: ^4.5
Requires (Dev)
- phpstan/phpstan: ^0.12.19
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-11-29 06:10:09 UTC
README
Only 6 characters. URL Shortener based on Slim 4 (PSR-7 and PSR-15).
composer create-project locomotivemtl/o6c-api
API
Keep it simple.
GET /{code}
- Redirect to the original URL.
POST /api/v1/login
- Retrieve an auth token (jwt) from credentials.
POST /api/v1/shorten
- Create a new short-link. Must provide a valid access token.
See locomotivemtl/o6c-client for a simple client library to interact with this API.
Dependencies
- PHP 7.2+
- Slim 4
- pimple/pimple
- lcobucci/jwt
How to install
composer install
- Setup a MySQL/MariaDB database.
- Import the
data/schema.sql
.
- Import the
- Copy the
config/config.sample.php
toconfig/config.php
and edit its value to your environment. - Generate a RSA key for the JWT token
cd config;sh jwt.sh
. - Set up your web server (with a short URL!) to point to
public/
.- In dev, try
composer start
.
- In dev, try
Adding new users
Work in progress.
Add them manually in the users
table. The password format is
$password = password_hash($plain, PASSWORD_DEFAULT);