PHP Classes

PHP Chat API: Exchange chat messages between users using an API

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 282 All time: 7,597 This week: 57Up
Version License PHP version Categories
chat_api 1.0.0The PHP License5PHP 5, Web services, Chat
Description 

Author

This package can be used to exchange chat messages between users using an API.

It provides an API that with function end points to perform operations for implementing a chat system. Currently the API implements operations to:

- Authenticate a chat user
- Send a message from a user to another user
- Retrieve messages for a given user

Innovation Award
PHP Programming Innovation award nominee
July 2020
Number 4
Many sites need a chat system to allow exchanging message between users or chat with the site support people.

This package implements an API for a chat system that can be used to exchange messages between people on a regular browser using JavaScript or a mobile version of the site application to communicate with the API.

Manuel Lemos
Picture of uche
Name: uche <contact>
Classes: 9 packages by
Country: Nigeria Nigeria
Innovation award
Innovation award
Nominee: 7x

 

Documentation

Backend Chat API

A backend Chat API written in Laravel with these features:

  • Users can send and receive messages
  • Users are authenticated in order to send and retrieve messages using Laravel Passport
  • Uses cache system to increase speed of message retrieval
  • Feature tests written to assert users can login, send messages and retrieve messages

How to use

  • Clone project
  • Run composer install
  • Add .env file and specify credentials for cache and database (if needed)
  • Run php artisan migrate for migrations
  • Run php artisan db:seed to seed users
  • Run php artisan passport:install for laravel passport
  • Test endpoints

Endpoints

  • Login User - /api/auth/login [POST]

    Sample body - { "username":"john", "password":"password" }

  • Send Message - /api/messages [POST] Sample body - { "message":"hello world", "receiver_username":"john" } > This endpoint uses bearer token gotten from login endpoint
  • Retrieve Message - /api/messages [GET] > This endpoint uses bearer token gotten from login endpoint

Testing

Run the feature test - vender/bin/phpunit


  Files folder image Files (82)  
File Role Description
Files folder imageapp (2 files, 7 directories)
Files folder imagebootstrap (1 file)
Files folder imageconfig (14 files)
Files folder imagedatabase (3 directories)
Files folder imagepublic (4 files)
Files folder imageresources (4 directories)
Files folder imageroutes (4 files)
Files folder imagetests (2 files, 2 directories)
Accessible without login Plain text file .editorconfig Data Auxiliary data
Accessible without login Plain text file .env.example Data Auxiliary data
Accessible without login Plain text file .styleci.yml Data Auxiliary data
Plain text file artisan Class Class source
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file package.json Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file server.php Aux. Auxiliary script
Accessible without login Plain text file webpack.mix.js Data Auxiliary data

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:282
This week:0
All time:7,597
This week:57Up