Useful MiUse API Gate for RESTful API Mikrotik Userman Development, using Mikrotik Userman API Gateway.
Used technologies: PHP 7, Slim 4, MySQL, PHPUnit, dotenv, Docker & Docker Compose
.
- Composer.
- PHP 7.4+ or 8.0+.
- MySQL/MariaDB.
- or Docker.
You can create a new project running the following commands:
$ composer create-project bojezcreative/usermanapi [my-api-name]
$ cd [my-api-name]
$ composer test
$ composer start
By default, the API use a MySQL Database.
You should check and edit this configuration in your .env
file:
DB_HOST='127.0.0.1'
DB_NAME='yourMySqlDatabase'
DB_USER='yourMySqlUsername'
DB_PASS='yourMySqlPassword'
DB_PORT='3306'
ROS_HOST='192.168.1.xx'
ROS_USER='user'
ROS_PASS='pass'
ROS_PORT='8728'
If you like Docker, you can use this project with docker and docker-compose.
Minimal Docker Version:
- Engine: 18.03+
- Compose: 1.21+
Docker Commands:
# Create and start containers for the API.
$ docker-compose up -d --build
# Checkout the API.
$ curl http://localhost:8081
# Stop and remove containers.
$ docker-compose down
- slim/slim: Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs.
- slim/psr7: PSR-7 implementation for use with Slim 4.
- pimple/pimple: A small PHP dependency injection container.
- vlucas/phpdotenv: Loads environment variables from
.env
togetenv()
,$_ENV
and$_SERVER
automagically.
- phpunit/phpunit: The PHP Unit Testing framework.
- symfony/console: The Console component eases the creation of beautiful and testable command line interfaces.
- nunomaduro/phpinsights: Instant PHP quality checks from your console.
- maurobonfietti/slim4-api-skeleton-crud-generator: CRUD Generator for Slim 4 - Api Skeleton.
- Hello:
GET /
- Health Check:
GET /status
- Get User List from RouterOs:
GET /user/list
- Import User from RoS to DB:
GET /user/import
- Show User list from DB:
GET /user/show
Develop a RESTful API with PHP and Slim 4. [:movie_camera: :sound: :es: :argentina:]
You can support this project inviting me a coffee โ ๐ or giving a star to this repo โญ ๐.
Now go build a cool RESTful API.