added instruction of installation into README
This commit is contained in:
parent
2d3f8bfdd4
commit
f1e6e92f46
38
README.md
38
README.md
@ -2,6 +2,44 @@
|
||||
|
||||
A set of tools to simplify the work of creating backend APIs for your frontend projects. Includes tutorials, patterns and practical examples for creating projects based on REST APIs.
|
||||
|
||||
## Installation
|
||||
|
||||
Download source code and add to your project
|
||||
|
||||
```php
|
||||
<?php
|
||||
require_once __DIR__ . '/APIlite/src/APIlite.php';
|
||||
```
|
||||
|
||||
or use composer
|
||||
|
||||
```bash
|
||||
composer require tpsoft/apilite
|
||||
```
|
||||
|
||||
and add to your project
|
||||
|
||||
```php
|
||||
<?php
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
class YourAPI extends \TPsoft\APIlite\APIlite {
|
||||
|
||||
/**
|
||||
* My first method for greetings.
|
||||
*
|
||||
* @param string $name Your name
|
||||
* @param int $age Your age
|
||||
* @return string Greetings
|
||||
*/
|
||||
public function myFirstMethod(string $name, int $age): string
|
||||
{
|
||||
return 'Hi, I`m '.$name.' and I`m '.$age.' years old.';
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
## Basic usage
|
||||
|
||||
For example, we create an API for calculator. So we create class `APIcalculator` and store in file `test/APIcalculator.php` where we defined each actions for API as public method.
|
||||
|
Loading…
x
Reference in New Issue
Block a user