v1.0.0 2019-11-07 21:21 UTC

This package is auto-updated.

Last update: 2024-06-08 09:33:34 UTC


GitHub version Build Status codecov


How to use

  1. Installation

    $ composer require proficlos/vestacp-api
  2. Create Client

    a) Easy way

    use ProfiCloS\VestaCP\Client;
    // easy way to create Client
    $client = Client::simpleFactory('https://someHost', 'someUser', 'somePass');

    b) For some reasons (more hosts, etc) you may need create objects alone

    use ProfiCloS\VestaCP\Client;
    use ProfiCloS\VestaCP\Authorization\Credentials;
    use ProfiCloS\VestaCP\Authorization\Host;
    $credentials = new Credentials('someUser', 'somePassword');
    $host = new Host('https://someHost', $credentials);
    $client = new Client($host);
  3. Usage

    // verify login
    $client->testAuthorization(); // bool

    You can simply send one of prepared commands (or you can write own command - must implements \ProfiCloS\VestaCP\Command\ICommand )

    $command = new SomeCommand(); 
    $response = $client->send( $command );
    echo $response->getResponseText();

    Or you can use prepared modules

    a) user module

    $userModule = $client->getModuleUser();
    $userModule->list(); // returns all users with data
    $userModule->detail('admin'); // returns selected user with data
    $userModule->changePassword('admin', 'otherPa$$word');
    $userModule->add('other_user', 'pa$$word', '');
    // ... etc

    b) web module

    $webModule = $client->getModuleWeb('admin'); // web module needs user
    $webModule->addDomainLetsEncrypt('', ''); // needs longer timeout
    $webModule->addDomainFtp('', 'test', 'pa$$word');
    $webModule->changeDomainFtpPassword('', 'admin_test', 'otherPa$$word');
    $webModule->changeDomainFtpPath('', 'admin_test', 'path/other');
    $webModule->deleteDomainFtp('', 'admin_test');
    // ... etc

    c) mail module

    $mailModule = $client->getModuleMail('admin'); // mail module needs user
    $mailModule->listDomains(); // returns mail domains from selected user
    $mailModule->addDomain(''); // add domain
    $mailModule->listAccounts(''); // returns accounts from selected user and domain
    $mailModule->addAccount('', 'info', 'pa$$word'); // add account
    $mailModule->changeAccountPassword('', 'info', 'otherPa$$word'); // change password
    $mailModule->deleteAccount('', 'info');
    // ... etc

    d) db module

    // modules
    $dbModule = $client->getModuleDb(); 
    // todo
    // ... etc

    e) cron module

    $cronModule = $client->getModuleCron(); 
    // todo
    // ... etc

    f) backup module

    $backupModule = $client->getModuleBackup(); 
    // todo
    // ... etc

Buy us a coffee <3

Buy me a Coffee

Donate us <3

ETH: 0x7D771A56735500f76af15F589155BDC91613D4aB
UBIQ: 0xAC08C7B9F06EFb42a603d7222c359e0fF54e0a13