API build using PHP Slim Framework for storing the Tamil kavithai and Quotes in Database
- PHP 7.4
- Composer for install the packages
- SSL for secure Connection
- MYSQL 5.x or 8.x
- install the packages via Composer
composer install
- Add your DB details in
conf.php
file - Update your database table name in
index.php
replace mine with your's - Add user name and password for HTTP Auth (Check line no 20 in
index.php
) - Basic protection for POST Method - Create MYSQL database with Tamil Content Support
SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS `tamilcontent`;
CREATE TABLE `tamilcontent` (
`id` int NOT NULL AUTO_INCREMENT,
`content` text CHARACTER SET utf16 COLLATE utf16_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- That's all done
https://api.example.com/all - Get all content
https://api.example.com/random - Get Random Content
https://api.example.com/add - Post the content into Database
https://api.example.com/update/{id} - Update the Content in the Database
- Post Method
curl --request POST \
--url https://api.example.com/add \
--header 'authorization: Basic XXXXXXXXXXXXXXXXXXXXXXX' \
--header 'content-type: application/x-www-form-urlencoded' \
--data 'content=Example Tamil Content'
- PUT Method
curl --request PUT \
--url https://api.example.com/update/1 \
--header 'authorization: Basic XXXXXXXXXXXXXXXXXXXXXX' \
--header 'content-type: application/x-www-form-urlencoded' \
--data 'content=Example Edited Tamil Content'
- Open
/etc/nginx/nginx.conf
- Add this Below code inside http block
fastcgi_cache_path /etc/nginx/cache levels=1:2 keys_zone=sanapp:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
you can Update this API According to your usage this is Just Example API for Tamil Content
MIT