{"id":17333811,"url":"https://github.com/lotfio/pssh","last_synced_at":"2025-03-27T06:45:00.964Z","repository":{"id":54975323,"uuid":"321163420","full_name":"lotfio/pssh","owner":"lotfio","description":null,"archived":false,"fork":false,"pushed_at":"2021-01-23T13:37:42.000Z","size":28,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-01T11:44:52.453Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/lotfio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-13T21:26:31.000Z","updated_at":"2022-03-03T17:58:28.000Z","dependencies_parsed_at":"2022-08-14T07:50:57.081Z","dependency_job_id":null,"html_url":"https://github.com/lotfio/pssh","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lotfio%2Fpssh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lotfio%2Fpssh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lotfio%2Fpssh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lotfio%2Fpssh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lotfio","download_url":"https://codeload.github.com/lotfio/pssh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245798538,"owners_count":20673902,"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":[],"created_at":"2024-10-15T15:03:07.667Z","updated_at":"2025-03-27T06:45:00.943Z","avatar_url":"https://github.com/lotfio.png","language":"PHP","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/lotfio/pssh/blob/master/docs/logo.png\" alt=\"skeleton Preview\"\u003e\n  \u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Licence-MIT-ffd32a.svg\" alt=\"License\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/PHP-8-808e9b.svg\" alt=\"PHP version\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Version-0.1.0-f53b57.svg\" alt=\"Version\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/coverage-10%25-27ae60.svg\" alt=\"Coverage\"\u003e\n    \u003cimg src=\"https://travis-ci.org/lotfio/pssh.svg?branch=master\" alt=\"Build Status\"\u003e\n    \u003cimg src=\"https://github.styleci.io/repos/206574643/shield?branch=master\" alt=\"StyleCi\"\u003e\n    \u003c/p\u003e\n  \u003cp align=\"center\"\u003e\n    \u003cstrong\u003e:key:  easier php ssh  :key:\u003c/strong\u003e\n  \u003c/p\u003e\n\u003c/p\u003e\n\n### :fire: Introduction :\nintroduction\n\n### :pushpin: Requirements :\n- [SSH2 extension](https://www.php.net/manual/en/book.ssh2.php)\n- PHP 7.2 or newer versions\n- PHPUnit \u003e= 8 (for testing purpose)\n\n### :rocket: Installation \u0026 Use :\n```php\ncomposer require lotfio/pssh\n```\n\n### :pencil2: SSH:\n```php\n\u003c?php\n\n// basic usage example\n\nrequire 'vendor/autoload.php';\n\n$config = [\n    'host'    =\u003e 'my-host',\n    'auth'    =\u003e  new Pssh\\Auth\\AuthUserPass('lotfio', 'secret')\n];\n\n$ssh  = new Pssh\\Pssh($config);\necho $ssh-\u003eexec(\"date\");  // Sat Nov 14 08:10:20 PM CET 2020\n\n```\n\n### :gear: confguration:\n - config keys\n```php\n  // additional details\n  $config = [\n    'host'      =\u003e 'server host',\n    'port'      =\u003e 'server port || default 22',\n    'auth'      =\u003e 'authentication method: AuthUserPass, AuthKeys, AuthHostBasedFile, AuthAgent or AuthNone.',\n    'timeout'   =\u003e 'timeout when trying to connect',\n    'methods'   =\u003e 'connection method checkout ssh2_connect form more details'\n    'callbacks' =\u003e 'connection callbacks checkout ssh2_connect form more details'\n  ];\n```\n - **available SSH methods:**\n    - `$ssh-\u003eexec(string $command):  string` execute a shell command.\n    - `$ssh-\u003efingerprint(int $type): string` get connection finger print.\n    - `$ssh-\u003emethodsNegotiated(): array`     return an array of negotiated methods.\n    - `$ssh-\u003eaddPublicKey(): bool`           add a public key.\n    - `$ssh-\u003eremovePublicKey(): bool`        remove public key.\n    - `$ssh-\u003elistPublicKeys(): array`        list public keys.\n    - `$ssh-\u003etunnel(): resource`             open an ssh tunnel.\n\n ### :pencil2: SFTP:\n```php\n\u003c?php\n\nrequire 'vendor/autoload.php';\n\n$config = [\n    'host'    =\u003e 'my-host',\n    'auth'    =\u003e  new Pssh\\Auth\\AuthUserPass('lotfio', 'secret')\n];\n\n$ssh  = new Pssh\\Pssh($config);\n$sftp = new Pssh\\Psftp($ssh);\n\n$sftp-\u003ecopyToServer('local-file', 'remote-file');\n\n```\n - **available SSH methods:**\n  - `$sftp-\u003ecopyToServer(): bool`       copy a file from local to remote server.\n  - `$sftp-\u003ecopyFromServer(): bool`     copy a file from remote server to local.\n  - `$sftp-\u003echmod(): bool`              change mod file or dir.\n  - `$sftp-\u003emkdir(): bool`              make directory.\n  - `$sftp-\u003ermdir(): bool`              remove directory.\n  - `$sftp-\u003esymlink(): bool`            create a symlink.\n  - `$sftp-\u003esymlinkTarget(): string`    read symlink target.\n  - `$sftp-\u003esymlinkStat(): array`       stating a symlink.\n  - `$sftp-\u003erealpath(): string`         get realpath.\n  - `$sftp-\u003erename(): bool`             rename file.\n  - `$sftp-\u003estat(): array`              get file stat.\n  - `$sftp-\u003eunlink(): bool`             delete file.\n\n### :computer: Contributing\n\n- Thank you for considering to contribute to ***Package***. All the contribution guidelines are mentioned [here](CONTRIBUTING.md).\n\n### :page_with_curl: ChangeLog\n\n- Here you can find the [ChangeLog](CHANGELOG.md).\n\n### :beer: Support the development\n\n- Share ***Package*** and lets get more stars and more contributors.\n- If this project helped you reduce time to develop, you can give me a cup of coffee :) : **[Paypal](https://www.paypal.me/lotfio)**. 💖\n\n### :clipboard: License\n\n- ***Package*** is an open-source software licensed under the [MIT license](LICENSE).\n","funding_links":["https://www.paypal.me/lotfio)*"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flotfio%2Fpssh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flotfio%2Fpssh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flotfio%2Fpssh/lists"}