johndab / lumen-message-microservice
This package is abandoned and no longer maintained.
No replacement package was suggested.
lumen-message-microservice.
dev-master
2020-04-07 21:33 UTC
Requires
- php: >=7.1.3
- laravel/lumen-framework: 5.7.*
- vlucas/phpdotenv: ~2.2
Requires (Dev)
- fzaninotto/faker: ~1.4
- mockery/mockery: ~1.0
- phpunit/phpunit: ~7.0
This package is auto-updated.
Last update: 2022-11-18 00:38:45 UTC
README
Deployable as independent microservice with its own database providing REST API for managing threads and messages
Prerequisites
- php
- composer
- MySql
Installation
- Rename
.env.example
to.env
- Update
.env
:- Set
APP_DEBUG
tofalse
and specifyAPP_KEY
(32 random characters) andAPP_TOKEN
- Create empty database and set connection details
- You can specify
APP_URL_PREFIX
to add a prefix to all endpoints
- Set
- Run:
# Install dependencies and optimize composer autoloader $ composer install --optimize-autoloader --no-dev # Create all tables $ php artisan migrate
Threads
Each request must have
App-Token
header with the correct token specified in.env
Get all client threads
GET /threads/{clientId}
- Url
- int clientId (required)
Add thread
POST /thread
- Body
- string title* - title of the new thread
- array(string) clients - UUIds of clients assigned to the thread
- string params - JSON with parameters for this thread
Update thread
PUT /thread/{threadId}/{clientId?}
- Url
- int threadId* - Id of the thread to update
- string clientId - if specified will be checked if client have access to the thread
- Body
- string title - New title (not updated if null)
- string params - New params
Delete thread
DELETE /thread/{threadId}/{clientId?}
- Url
- int threadId* - Id of the thread to delete
- string clientId - if specified will be checked if client have access to the thread
Add clients
POST /thread/clients/{threadId}/{clientId?}
- Url
- int threadId* - Id of the thread to delete
- string clientId - if specified will be checked if client have access to the thread
- Body
- array(string) clients - Ids of clients to add
Remove clients
DELETE /thread/clients/{threadId}/{clientId?}
- Url
- int threadId* - Id of the thread to delete
- string clientId - if specified will be checked if client have access to the thread
- Body
- array(string) clients - Ids of clients to remove
Messages
Get messages
GET /messages/{threadId}/{clientId?}
- Url
- int threadId* - Id of the thread
- string clientId - if specified will be checked if client have access to the thread
- Query string
- int take - number of messages to take (default: 10)
- int skip - number of message to skip (default: 0)
Add a message
POST /message/{threadId}
- Url
- int threadId* - Id of the thread
- Body
- string content* - Message content
- int clientId*
- string params - JSON with parameters for this messages
License
This project is licensed under the MIT License