{"id":21991446,"url":"https://github.com/neto737/hestiacp-api","last_synced_at":"2025-04-30T13:50:22.982Z","repository":{"id":41206743,"uuid":"381400487","full_name":"neto737/HestiaCP-API","owner":"neto737","description":"HestiaCP API SDK written in PHP","archived":false,"fork":false,"pushed_at":"2022-06-29T14:49:08.000Z","size":42,"stargazers_count":6,"open_issues_count":1,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-08-18T12:56:16.229Z","etag":null,"topics":["php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neto737.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"liberapay":"neto737","custom":["https://paypal.me/neto737","https://www.blockchain.com/btc/address/bc1q89ntljt5lk7g9z68f5cjs83qfm2xme7g4hkur7","https://etherscan.io/address/0xeef9220639F14E7A0FD825AAAd0574e5a8aD7A4B","https://blockchair.com/litecoin/address/ltc1q508qfkd09vyya6c5zkfx4r248pf3ezj9ngjdr2"]}},"created_at":"2021-06-29T14:48:46.000Z","updated_at":"2024-07-08T22:36:22.000Z","dependencies_parsed_at":"2022-07-31T11:37:56.233Z","dependency_job_id":null,"html_url":"https://github.com/neto737/HestiaCP-API","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neto737%2FHestiaCP-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neto737%2FHestiaCP-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neto737%2FHestiaCP-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neto737%2FHestiaCP-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neto737","download_url":"https://codeload.github.com/neto737/HestiaCP-API/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251714772,"owners_count":21631781,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php"],"created_at":"2024-11-29T20:09:26.261Z","updated_at":"2025-04-30T13:50:22.961Z","avatar_url":"https://github.com/neto737.png","language":"PHP","funding_links":["https://liberapay.com/neto737","https://paypal.me/neto737","https://www.blockchain.com/btc/address/bc1q89ntljt5lk7g9z68f5cjs83qfm2xme7g4hkur7","https://etherscan.io/address/0xeef9220639F14E7A0FD825AAAd0574e5a8aD7A4B","https://blockchair.com/litecoin/address/ltc1q508qfkd09vyya6c5zkfx4r248pf3ezj9ngjdr2"],"categories":[],"sub_categories":[],"readme":"\n# HestiaCP PHP API\n\n  \n[![Name](https://badgen.net/packagist/name/neto737/hestiacp-api)](//packagist.org/packages/neto737/hestiacp-api) [![Latest Stable Version](https://badgen.net/packagist/v/neto737/hestiacp-api/latest)](https://packagist.org/packages/neto737/hestiacp-api) [![Total Downloads](https://badgen.net/packagist/dt/neto737/hestiacp-api)](https://packagist.org/packages/neto737/hestiacp-api)  [![License](https://badgen.net/packagist/license/neto737/hestiacp-api)](https://packagist.org/packages/neto737/hestiacp-api) [![Build Status](https://www.travis-ci.com/neto737/HestiaCP-API.svg?branch=main)](https://www.travis-ci.com/github/neto737/HestiaCP-API) [![codecov](https://codecov.io/gh/neto737/HestiaCP-API/branch/main/graph/badge.svg?token=F93I5JQXY6)](https://codecov.io/gh/neto737/HestiaCP-API)\n\n  \n\n## How to use\n\n1) Installation\n\n```sh\n\n$ composer require neto737/hestiacp-api\n\n```\n\n2) Create Client\n\na) Easy way\n\n```php\n\nuse neto737\\HestiaCP\\Client;\n\n// Easy way to create Client\n\n// Using API Key\n$client = Client::simpleFactory('https://someHost', 'API_Key');\n\n// Using username and password\n$client = Client::simpleFactory('https://someHost', 'someUser', 'somePass');\n\n```\n\nb) For some reasons (more hosts, etc) you may need create objects alone\n\n```php\n\nuse neto737\\HestiaCP\\Client;\nuse neto737\\HestiaCP\\Authorization\\Credentials;\nuse neto737\\HestiaCP\\Authorization\\Host;\n\n// You can choose to use an API Key or username and password\n\n// API Key\n$credentials = new Credentials('API_Key');\n\n// Username and Password\n$credentials = new Credentials('someUser', 'somePassword');\n\n$host = new Host('https://someHost', $credentials);\n\n$client = new Client($host);\n\n```\n\n3) Usage\n\n```php\n\n// verify login\n$client-\u003etestAuthorization(); // bool\n\n```\n\nYou can simply send one of prepared commands (or you can write own command - must implements `\\neto737\\HestiaCP\\Command\\ICommand` )\n\n```php\n\n$command = new SomeCommand();\n\n$response = $client-\u003esend($command);\n\n\necho $response-\u003egetResponseText();\n\n```\n\nOr you can use prepared modules\n\na) user module\n\n```php\n\n$userModule = $client-\u003egetModuleUser();\n\n\n$userModule-\u003elist(); // returns all users with data\n\n$userModule-\u003edetail('admin'); // returns selected user with data\n\n$userModule-\u003echangePassword('admin', 'otherPa$$word');\n\n$userModule-\u003eadd('other_user', 'pa$$word', 'some@email.com');\n\n$userModule-\u003esuspend('other_user');\n\n$userModule-\u003eunsuspend('other_user');\n\n$userModule-\u003edelete('other_user');\n\n```\n\nb) web module\n\n```php\n\n$webModule = $client-\u003egetModuleWeb('admin'); // web module needs user\n\n\n$webModule-\u003elistDomains();\n\n$webModule-\u003eaddDomain('domain.com');\n\n$webModule-\u003eaddDomainLetsEncrypt('domain.com', 'www.domain.com'); // needs longer timeout\n\n$webModule-\u003edeleteDomainLetsEncrypt('domain.com');\n\n$webModule-\u003eaddDomainFtp('domain.com', 'test', 'pa$$word');\n\n$webModule-\u003echangeDomainFtpPassword('domain.com', 'admin_test', 'otherPa$$word');\n\n$webModule-\u003echangeDomainFtpPath('domain.com', 'admin_test', 'path/other');\n\n$webModule-\u003edeleteDomainFtp('domain.com', 'admin_test');\n\n$webModule-\u003esuspendDomain('domain.com');\n\n$webModule-\u003eunsuspendDomain('domain.com');\n\n$webModule-\u003edeleteDomain('domain.com');\n\n```\n\nc) mail module\n\n```php\n\n$mailModule = $client-\u003egetModuleMail('admin'); // mail module needs user\n\n\n$mailModule-\u003elistDomains(); // returns mail domains from selected user\n\n$mailModule-\u003eaddDomain('domain.com'); // add domain\n\n$mailModule-\u003elistAccounts('domain.com'); // returns accounts from selected user and domain\n\n$mailModule-\u003elistDomainDkim('domain.com');\n\n$mailModule-\u003elistDomainDkimDns('domain.com');\n\n$mailModule-\u003eaddAccount('domain.com', 'info', 'pa$$word'); // add info@domain.com account\n\n$mailModule-\u003echangeAccountPassword('domain.com', 'info', 'otherPa$$word'); // change info@domain.com password\n\n$mailModule-\u003esuspendAccount('domain.com', 'info'); // suspend info@domain.com account\n\n$mailModule-\u003eunsuspendAccount('domain.com', 'info'); // unsuspend info@domain.com account\n\n$mailModule-\u003edeleteAccount('domain.com', 'info');\n\n$mailModule-\u003esuspendDomain('domain.com');\n\n$mailModule-\u003eunsuspendDomain('domain.com');\n\n$mailModule-\u003edeleteDomain('domain.com');\n\n```\n\nd) db module\n\n```php\n\n$dbModule = $client-\u003egetModuleDatabase('admin');\n\n\n$dbModule-\u003eadd('database', 'dbuser', 'dbpass');\n\n$dbModule-\u003edelete('admin_database');\n\n$dbModule-\u003edeleteDatabases();\n\n$dbModule-\u003elistDatabase('database');\n\n$dbModule-\u003elistDatabases();\n\n\n// todo\n\n// ... etc\n\n```\n\ne) cron module\n\n```php\n\n$cronModule = $client-\u003egetModuleCron();\n\n\n// todo\n\n// ... etc\n\n```\n\nf) backup module\n\n```php\n\n$backupModule = $client-\u003egetModuleBackup('admin'); // backup module needs user\n\n$backupModule-\u003ebackup(); // create a new backup\n\n$backupModule-\u003edelete('admin.2021-10-13_18-12-53.tar'); // delete an user backup\n\n$backupModule-\u003edeleteExclusions(); // delete all backup exclusions\n\n$backupModule-\u003elistBackups(); // returns the backups list\n\n$backupModule-\u003elistBackup('admin.2021-10-13_18-12-53.tar'); // returns backup parameters list\n\n$backupModule-\u003elistBackupExclusions(); // returns the backup exclusions list\n\n```\n\n## Donate :heart:\n\n```\nBTC: bc1q89ntljt5lk7g9z68f5cjs83qfm2xme7g4hkur7\nETH: 0xeef9220639F14E7A0FD825AAAd0574e5a8aD7A4B\nLTC: ltc1q508qfkd09vyya6c5zkfx4r248pf3ezj9ngjdr2\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneto737%2Fhestiacp-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneto737%2Fhestiacp-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneto737%2Fhestiacp-api/lists"}