Open SSH terminal from the Cloudways panel and and sign in with your username and password. Now go to the folder where you want to install SLIM with cd command
Input the following command in the terminal to install Slim via composer.
Shell composer require slim/slim"^3.0" 1 composer require slim/slim"^3.0"
After installing Slim, the following piece of code will require it in the index.php file to require autoload file and instantiate Slim.
$app = new Slim\App();
Create a Database in MySQL. Make a new API call in the index.php through the following code:
CREATE TABLE IF NOT EXISTS `library` (
`book_id` int(11) NOT NULL,
`book_name` varchar(100) NOT NULL,
`book_isbn` varchar(100) NOT NULL,
`book_category` varchar(100) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
INSERT INTO `library` (`book_id`, `book_name`, `book_isbn`, `book_category`) VALUES
(1, 'PHP', 'bk001', 'Server Side'),
(4, 'Python', 'bk003', 'Data Analysis');
The full article is here: REST API in Slim