Skip to content

Commit 37d062e

Browse files
committed
Adding instructions to readme
1 parent 24962db commit 37d062e

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Related projects:
2121

2222
This is a single file application! Upload "api.php" somewhere and enjoy!
2323

24+
Alternatively, you can use [Composer](https://getcomposer.org/). See the _Composer Installation_ section below.
25+
2426
## Limitations
2527

2628
- Primary keys should either be auto-increment (from 1 to 2^53) or UUID
@@ -1028,6 +1030,39 @@ string(6) "/posts"
10281030

10291031
If it does not, something is wrong on your hosting environment.
10301032

1033+
## Composer Installation
1034+
1035+
- Include the library in your composer.json file:
1036+
1037+
```json
1038+
{
1039+
"require": {
1040+
"mevdschee/php-crud-api": "dev-master"
1041+
}
1042+
}
1043+
```
1044+
1045+
- Run `composer install`
1046+
- Use the library in your own code:
1047+
1048+
```php
1049+
<?php
1050+
1051+
include './vendor/autoload.php';
1052+
1053+
// DB Connection
1054+
$api = new PHP_CRUD_API(array(
1055+
'dbengine'=>'MySQL',
1056+
'hostname'=>'localhost',
1057+
'username'=>'',
1058+
'password'=>'',
1059+
'database'=>'',
1060+
'charset'=>'utf8'
1061+
));
1062+
$api->executeCommand();
1063+
1064+
```
1065+
10311066
## License
10321067

10331068
MIT

0 commit comments

Comments
 (0)