Simple REST chat application for demo purposes. This application could be also possible using ReactPHP and WebSockets.
Information for setting up the development environment is at setup.md
There are 2 users for demo purposes
# Demo User 1
user1@demo.com
user1password
# Demo User 2
user2@demo.com
user2password
The application is using simple authentication. You need to login using user credentials, retrieve the auto-generated token an pass an Authorisation header
Any attempt for unauthorised access throws JSON Response with 401 status code.
GET api/users/1/messages
> {"error":"Unauthorized"}
A user must login in order to retrieve his api_key
POST api/login
email=user1@demo.com
password=user1pass
> {"status":"success","api_key":"XXXXXXXX"}
A user can post a new message to a specific receiver (another user id).
# Headers/key: Authorization (or HTTP_Authorization) : XXXXXXXX
POST api/messages
> 200 {"status":"success","result":{}}
A user can retrieve all its messages from a specific sender (another user id).
# Headers/key: Authorization (or HTTP_Authorization) : XXXXXXXX
GET api/users/1/messages
> 200 {"status":"success","result":{}}
Tests are located under the /tests
directory
vendor/bin/phpunit
You can teardown be using the following command:
docker-compose -f docker-compose.local.yml down