{"id":18397295,"url":"https://github.com/php-ffi/env","last_synced_at":"2025-04-07T04:33:08.841Z","repository":{"id":62504316,"uuid":"393765030","full_name":"php-ffi/env","owner":"php-ffi","description":"A set of API methods for working with the FFI environment","archived":false,"fork":false,"pushed_at":"2024-12-17T00:28:12.000Z","size":27,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-19T06:53:10.762Z","etag":null,"topics":["ffi","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/php-ffi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-07T18:43:33.000Z","updated_at":"2024-12-17T00:28:16.000Z","dependencies_parsed_at":"2024-12-17T01:46:17.607Z","dependency_job_id":null,"html_url":"https://github.com/php-ffi/env","commit_stats":{"total_commits":12,"total_committers":1,"mean_commits":12.0,"dds":0.0,"last_synced_commit":"cb3a2c3d8df55897e69bc31682a4f031138f7a15"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-ffi%2Fenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-ffi%2Fenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-ffi%2Fenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-ffi%2Fenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php-ffi","download_url":"https://codeload.github.com/php-ffi/env/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247595360,"owners_count":20963939,"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":["ffi","php"],"created_at":"2024-11-06T02:16:38.466Z","updated_at":"2025-04-07T04:33:03.789Z","avatar_url":"https://github.com/php-ffi.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FFI Environment\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://packagist.org/packages/ffi/env\"\u003e\u003cimg src=\"https://poser.pugx.org/ffi/env/require/php?style=for-the-badge\" alt=\"PHP 8.1+\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/ffi/env\"\u003e\u003cimg src=\"https://poser.pugx.org/ffi/env/version?style=for-the-badge\" alt=\"Latest Stable Version\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/ffi/env\"\u003e\u003cimg src=\"https://poser.pugx.org/ffi/env/v/unstable?style=for-the-badge\" alt=\"Latest Unstable Version\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/ffi/env\"\u003e\u003cimg src=\"https://poser.pugx.org/ffi/env/downloads?style=for-the-badge\" alt=\"Total Downloads\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://raw.githubusercontent.com/php-ffi/env/master/LICENSE.md\"\u003e\u003cimg src=\"https://poser.pugx.org/ffi/env/license?style=for-the-badge\" alt=\"License MIT\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/php-ffi/env/actions\"\u003e\u003cimg src=\"https://github.com/php-ffi/env/workflows/build/badge.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nA set of API methods for working with the FFI environment.\n\n## Requirements\n\n- PHP \u003e= 7.4\n\n## Installation\n\nLibrary is available as composer repository and can be installed using the \nfollowing command in a root of your project.\n\n```sh\n$ composer require ffi/env\n```\n\n## Usage\n\n### Retrieve FFI Status\n\n```php\nuse FFI\\Env\\Runtime;\n\n$status = Runtime::getStatus();\n```\n\nStatus can be be one of:\n- `\\FFI\\Env\\Status::NOT_AVAILABLE` - Extension not available.\n- `\\FFI\\Env\\Status::DISABLED` - Extension disabled.\n- `\\FFI\\Env\\Status::ENABLED` - Extension enabled and available in any environment.\n- `\\FFI\\Env\\Status::CLI_ENABLED` - Extension available only in CLI SAPI or using a preload.\n\n### Checking Availability\n\n```php\nuse FFI\\Env\\Runtime;\n\n$isAvailable = Runtime::isAvailable();\n```\n\nIn the case that the environment needs to be checked unambiguously, then you \ncan use `assertAvailable()` method:\n\n```php\nuse FFI\\Env\\Runtime;\n\nRuntime::assertAvailable();\n// Throws an \\FFI\\Env\\Exception\\EnvironmentException in case FFI is not available.\n```\n\n### Optimization\n\nTo check the environment, it is recommended to use the `assert` functionality.\n\n```php\nuse FFI\\Env\\Runtime;\nuse FFI\\Env\\Exception\\EnvironmentException;\n\nassert(Runtime::assertAvailable());\n\n// Or using your own assertion error message:\nassert(Runtime::isAvailable(), EnvironmentException::getErrorMessageFromStatus());\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-ffi%2Fenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp-ffi%2Fenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-ffi%2Fenv/lists"}