Simple, light and extensible api based on the symfony framework
composer install
-
- copy
.env.example
to.env.local
- copy
- copy
docker/database/.env.example
todocker/database/.env
- Add values for
APP_SECRET
ANDDATABASE_URL
php bin/console lexik:jwt:generate-keypair
mkcert -cert-file docker/nginx/crm-api.local.crt -key-file docker/nginx/crm-api.local.key crm-api.local
mkcert -install
docker compose build
docker compose up
add 127.0.0.1 crm-api.local to your hosts file
The CRM API is now running locally in docker at crm-api.local
php bin/console security:hash-password
- make a hash for YOURPASSWORD- Import your new user to your database:
INSERT INTO `user` (`id`, `username`, `roles`, `password`) VALUES (NULL, 'USERNAME', '[]', 'YOURPASSWORDHASH');
symfony server:start
- Use Postman to send a POST request to
localhost:8000/api/login_check
with this JSON Body
{
"username": "USERNAME",
"password": "YOURPASSWORD"
}
- You will get a response like this:
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1N...."
}
- You can now use this Token as Bearer Token in the AUTHORIZATION Header for all API Requests