{"id":17989482,"url":"https://github.com/evilfreelancer/easyrsa-php","last_synced_at":"2025-07-26T09:36:36.922Z","repository":{"id":62503220,"uuid":"146764281","full_name":"EvilFreelancer/easyrsa-php","owner":"EvilFreelancer","description":"EasyRSA wrapper for PHP","archived":false,"fork":false,"pushed_at":"2020-07-29T04:51:39.000Z","size":57,"stargazers_count":7,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-20T22:09:44.935Z","etag":null,"topics":["certificate-manager","easy-rsa","easyrsa","easyrsa3","laravel","lumen","openvpn","package","php-library","php7","wrapper"],"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/EvilFreelancer.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":{"patreon":"efreelancer"}},"created_at":"2018-08-30T14:45:38.000Z","updated_at":"2023-12-16T14:46:26.000Z","dependencies_parsed_at":"2022-11-02T10:15:36.915Z","dependency_job_id":null,"html_url":"https://github.com/EvilFreelancer/easyrsa-php","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilFreelancer%2Feasyrsa-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilFreelancer%2Feasyrsa-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilFreelancer%2Feasyrsa-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilFreelancer%2Feasyrsa-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EvilFreelancer","download_url":"https://codeload.github.com/EvilFreelancer/easyrsa-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245561139,"owners_count":20635680,"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":["certificate-manager","easy-rsa","easyrsa","easyrsa3","laravel","lumen","openvpn","package","php-library","php7","wrapper"],"created_at":"2024-10-29T19:14:47.523Z","updated_at":"2025-03-25T23:30:42.745Z","avatar_url":"https://github.com/EvilFreelancer.png","language":"PHP","funding_links":["https://patreon.com/efreelancer"],"categories":[],"sub_categories":[],"readme":"[![Latest Stable Version](https://poser.pugx.org/evilfreelancer/easyrsa-php/v/stable)](https://packagist.org/packages/evilfreelancer/easyrsa-php)\n[![Total Downloads](https://poser.pugx.org/evilfreelancer/easyrsa-php/downloads)](https://packagist.org/packages/evilfreelancer/easyrsa-php)\n[![Build Status](https://scrutinizer-ci.com/g/EvilFreelancer/easyrsa-php/badges/build.png?b=master)](https://scrutinizer-ci.com/g/EvilFreelancer/easyrsa-php/build-status/master)\n[![Code Coverage](https://scrutinizer-ci.com/g/EvilFreelancer/easyrsa-php/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/EvilFreelancer/easyrsa-php/?branch=master)\n[![Code Climate](https://codeclimate.com/github/EvilFreelancer/easyrsa-php/badges/gpa.svg)](https://codeclimate.com/github/EvilFreelancer/easyrsa-php)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/EvilFreelancer/easyrsa-php/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/EvilFreelancer/easyrsa-php/?branch=master)\n[![License](https://poser.pugx.org/evilfreelancer/easyrsa-php/license)](https://packagist.org/packages/evilfreelancer/easyrsa-php)\n\n# EasyRSA wrapper for PHP\n\nAn easy way to use the [official EasyRSA](https://github.com/OpenVPN/easy-rsa) collection of shell\nscripts in your application.\n\n    composer require evilfreelancer/easyrsa-php\n\nBy the way, EasyRSA library support Laravel and Lumen frameworks, details [here](#frameworks-support).\n\n## How to use\n\nMore examples you can find [here](examples).\n\n### Download the latest release of EasyRSA\n\nBefore you start use this script need to download the [easy-rsa](https://github.com/OpenVPN/easy-rsa) package.\n\n```php\nrequire_once __DIR__ . '/../vendor/autoload.php';\n\nuse EasyRSA\\Downloader;\n\n$dnl = new Downloader([\n    'archive' =\u003e './easy-rsa.tar.gz',\n    'scripts' =\u003e './easy-rsa',\n]);\n\n$dnl-\u003egetEasyRSA();\n```\n\nResult of this script will be in `easy-rsa` folder.\n\n### Generate certificates\n\n```php\nrequire_once __DIR__ . '/../vendor/autoload.php';\n\nuse Dotenv\\Dotenv;\nuse EasyRSA\\Commands;\n\n// Load dotenv?\nif (file_exists(__DIR__ . '/../vars.example')) {\n    Dotenv::createImmutable(__DIR__ . '/../', 'vars.example')-\u003eload();\n}\n\n$cmd = new Commands([\n    'scripts' =\u003e './easy-rsa',\n    'certs'   =\u003e './easy-rsa-certs',\n]);\n\n$cmd-\u003einitPKI();\n$cmd-\u003ebuildCA(true);\n$cmd-\u003egenDH();\n$cmd-\u003ebuildServerFull('server', true);\n$cmd-\u003ebuildClientFull('client1', true);\n$cmd-\u003ebuildClientFull('client2', true);\n```\n\nResult of this script will be in `easy-rsa-certs` folder.\n\n### List of all available commands\n\n| Method                                              | Description |\n|-----------------------------------------------------|-------------|\n| getContent(string $filename)                        | Show content of any certificate available in \"certs\" folder |\n| initPKI()                                           | Instantiate Public Key Infrastructure (PKI) |\n| buildCA(bool $nopass = false)                       | Build Certificate Authority (CA) |\n| genDH()                                             | Generate Diffie-Hellman certificate (DH) |\n| genReq()                                            | Generate request for certificate |\n| signReqClient(string $filename)                     | Sign request for client certificate |\n| signReqServer(string $filename)                     | Sign request for server certificate |\n| buildClientFull(string $name, bool $nopass = false) | Build public and private key of client |\n| buildServerFull(string $name, bool $nopass = false) | Build public and private key of server |\n| revoke(string $filename)                            | Revoke certificate |\n| genCRL()                                            | Generate Certificate Revocation List (CRL) |\n| updateDB()                                          | Update certificates database |\n| showCert(string $filename)                          | Display information about certificate |\n| showReq(string $filename)                           | Display information about request |\n| importReq(string $filename)                         | Import request |\n| exportP7(string $filename)                          | Export file in format of Public-Key Cryptography Standards (PKCS) v7 (P7) |\n| exportP12(string $filename)                         | Export file in format of Public-Key Cryptography Standards (PKCS) v12 (P12) |\n| setRSAPass(string $filename)                        | Set password in Rivest–Shamir–Adleman (RSA) format |\n| setECPass(string $filename)                         | Set password in Elliptic Curve (EC) format |\n\nYou also can read content of generated certificate via `getConfig($filename)` method:\n\n```php\n\u003c?php\nrequire_once __DIR__ . '/../vendor/autoload.php';\n\nuse \\EasyRSA\\Commands;\n\n$cmd = new Commands([\n    'scripts' =\u003e './easy-rsa',\n    'certs'   =\u003e './easy-rsa-certs',\n]);\n\n$file = $cmd-\u003egetContent('ca.crt');\necho \"$file\\n\";\n\n$file = $cmd-\u003egetContent('server.crt');\necho \"$file\\n\";\n\n$file = $cmd-\u003egetContent('server.key');\necho \"$file\\n\";\n```\n\n## Environment variables\n\nYou can set these variables via environment on host system or with help\nof [vlucas/phpdotenv](https://github.com/vlucas/phpdotenv) library or via\nany other way which you like.\n\n```dotenv\nEASYRSA_DN=\"cn_only\"\n#EASYRSA_DN=\"org\"\nEASYRSA_REQ_COUNTRY=\"DE\"\nEASYRSA_REQ_PROVINCE=\"California\"\nEASYRSA_REQ_CITY=\"San Francisco\"\nEASYRSA_REQ_ORG=\"Copyleft Certificate Co\"\nEASYRSA_REQ_EMAIL=\"me@example.net\"\nEASYRSA_REQ_OU=\"My Organizational Unit\"\nEASYRSA_REQ_CN=\"ChangeMe\"\nEASYRSA_KEY_SIZE=2048\nEASYRSA_ALGO=rsa\nEASYRSA_CA_EXPIRE=3650\nEASYRSA_CERT_EXPIRE=3650\nEASYRSA_DIGEST=\"sha256\"\n```\n\nExample of environment variables configuration which should be used on certificate\nbuild stage can be fond [here](vars.example). \n\n## Frameworks support\n\n### Laravel\n\nThe package's service provider will automatically register its service provider.\n\nPublish the `easy-rsa.php` configuration file:\n\n```sh\nphp artisan vendor:publish --provider=\"EasyRSA\\Laravel\\ServiceProvider\"\n```\n\n#### Alternative configuration method via .env file\n\nAfter you publish the configuration file as suggested above, you may configure library\nby adding the following to your application's `.env` file (with appropriate values):\n  \n```ini\nEASYRSA_WORKER=default\nEASYRSA_ARCHIVE=./easy-rsa.tar.gz\nEASYRSA_SCRIPTS=./easy-rsa\nEASYRSA_CERTS=./easy-rsa-certs\n```\n\n### Lumen\n\nIf you work with Lumen, please register the service provider and configuration in `bootstrap/app.php`:\n\n```php\n$app-\u003eregister(EasyRSA\\Laravel\\ServiceProvider::class);\n$app-\u003econfigure('easy-rsa');\n```\n\nManually copy the configuration file to your application.\n\n## Testing\n\nThis library can tested in multiple different ways\n\n```shell script\ncomposer test:lint\ncomposer test:types\ncomposer test:unit\n```\n\nor just in one command\n\n```shell script\ncomposer test\n```\n\n## Links\n\n* https://github.com/RMerl/asuswrt-merlin.ng/wiki/Generating-OpenVPN-keys-using-Easy-RSA\n* https://github.com/OpenVPN/easy-rsa\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevilfreelancer%2Feasyrsa-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevilfreelancer%2Feasyrsa-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevilfreelancer%2Feasyrsa-php/lists"}