Simple, light and extensible api based on the symfony framework
composer install-
- copy
.env.exampleto.env.local
- copy
- copy
docker/database/.env.exampletodocker/database/.env - Add values for
APP_SECRETANDDATABASE_URL php bin/console lexik:jwt:generate-keypairmkcert -cert-file docker/nginx/crm-api.local.crt -key-file docker/nginx/crm-api.local.key crm-api.localmkcert -installdocker compose builddocker compose upadd 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_checkwith 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