woenel / laravesta
This package is abandoned and no longer maintained.
No replacement package was suggested.
VestaCP API for Laravel.
v0.3.0
2018-07-31 14:38 UTC
Requires
- php: >=7.0.0
- guzzlehttp/guzzle: ^6.3
- laravel/framework: 5.5.* || 5.6.*
This package is auto-updated.
Last update: 2021-04-29 01:04:55 UTC
README
VestaCP API for Laravel.
Installation
Install using Composer
$ composer require woenel/laravesta "^0.3"
Publish the config file named laravesta.php
so you can set the hostname, username, password and other configuration.
$ php artisan vendor:publish --provider="Woenel\Laravesta\LaravestaServiceProvider"
Usage
Create User Account
use Laravesta;
$res = Laravesta::execute('v-add-user', [
'arg1' => 'user01', // username
'arg2' => 'p@ssw0rd', // password
'arg3' => 'user01@example.com', // email
'arg4' => 'default', // package
'arg5' => 'Ronnel', // first name
'arg6' => 'Martinez' // last name
]);
if($res->getCode() == 0) {
return "User account has been successfuly created";
}
return "Query returned error code: " . $res->getCode();
getCode()
returns code instead of data.
See https://vestacp.com/docs/api/#return_codes for returned code meaning.
List User Account
use Laravesta;
$res = Laravesta::execute('v-list-user', [
'arg1' => 'user01', // username
'arg2' => 'json' // format
]);
return json_decode($res->getData(), true);
If the command (like v-list-user
) is expected to return data aside from code, you can use getData()
to get it.
For more commands (like v-add-user
and v-list-user
), visit VestaCP CLI Documentation at https://vestacp.com/docs/cli/.