Skip to content

Commit 1871f7b

Browse files
committed
Add some information to README
1 parent 3472985 commit 1871f7b

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,44 @@
11
# MTA:SA PHP SDK
2+
[![Build Status](https://travis-ci.com/multitheftauto/mtasa-php-sdk.svg?branch=master)](https://travis-ci.com/multitheftauto/mtasa-php-sdk)
23

34
You can access the MTA Web Interface from almost any programming language that can request web pages. PHP can do this very easily.
45

56
This SDK provides one function call that will allow you to call any exported script functions on any server that you have access to.
67

78
See the [official wiki page](https://wiki.multitheftauto.com/wiki/PHP_SDK) for further information.
9+
10+
## Installation
11+
12+
### Prerequisites
13+
14+
This SDK require PHP 7.1 or greater
15+
16+
### Setup
17+
18+
The only supported installation method is via [Composer](https://getcomposer.org). Run the following command to require this SDK in your project:
19+
20+
```
21+
composer require multitheftauto/mtasa-php-sdk
22+
```
23+
24+
### HTTPlug client abstraction
25+
26+
As this SDK use HTTPlug, you will have to require some libraries for get it working. See at [HTTPlug for library users](http://docs.php-http.org/en/latest/httplug/users.html).
27+
## A simple example
28+
29+
```php
30+
<?php
31+
32+
require_once('vendor/autoload.php');
33+
34+
use MultiTheftAuto\Sdk\Mta;
35+
use MultiTheftAuto\Sdk\Model\Server;
36+
use MultiTheftAuto\Sdk\Authentication\Credential;
37+
38+
$server = new Server('127.0.0.1', 22005);
39+
$credential = new Credential('myUser', 'myPassword');
40+
$mta = new Mta($server, $credential);
41+
42+
$response = $mta->getResource('someResource')->call('callableFunction');
43+
var_dump($response);
44+
```

0 commit comments

Comments
 (0)