{"id":15646291,"url":"https://github.com/shivammathur/cache-extensions","last_synced_at":"2025-05-16T12:01:49.307Z","repository":{"id":55439690,"uuid":"240154559","full_name":"shivammathur/cache-extensions","owner":"shivammathur","description":":package: Cache PHP extensions in GitHub Actions","archived":false,"fork":false,"pushed_at":"2025-05-15T15:05:19.000Z","size":4451,"stargazers_count":54,"open_issues_count":4,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-15T16:24:27.045Z","etag":null,"topics":["cache","github","github-actions","php","php-action","php-extensions"],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/cache-php-extensions","language":"Shell","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/shivammathur.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","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,"zenodo":null},"funding":{"github":"shivammathur"}},"created_at":"2020-02-13T01:47:40.000Z","updated_at":"2025-05-15T15:05:29.000Z","dependencies_parsed_at":"2023-09-26T18:59:16.930Z","dependency_job_id":"c4ee2398-9fe4-4fa7-a8fd-0edc80cafe6b","html_url":"https://github.com/shivammathur/cache-extensions","commit_stats":{"total_commits":224,"total_committers":5,"mean_commits":44.8,"dds":0.3660714285714286,"last_synced_commit":"2effacfdb5a0c06bc4fd2d9f9fb390c4c41d2205"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shivammathur%2Fcache-extensions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shivammathur%2Fcache-extensions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shivammathur%2Fcache-extensions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shivammathur%2Fcache-extensions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shivammathur","download_url":"https://codeload.github.com/shivammathur/cache-extensions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254376334,"owners_count":22060974,"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":["cache","github","github-actions","php","php-action","php-extensions"],"created_at":"2024-10-03T12:12:15.729Z","updated_at":"2025-05-16T12:01:49.300Z","avatar_url":"https://github.com/shivammathur.png","language":"Shell","readme":"\u003ch1 align=\"center\"\u003eCache PHP extensions in GitHub Actions\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/shivammathur/cache-extensions\" title=\"Cache PHP extensions in GitHub Actions\"\u003e\u003cimg alt=\"GitHub Actions status\" src=\"https://github.com/shivammathur/cache-extensions/workflows/Node%20test%20workflow/badge.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/shivammathur/cache-extensions\" title=\"Code coverage\"\u003e\u003cimg alt=\"Codecov Code Coverage\" src=\"https://codecov.io/gh/shivammathur/cache-extensions/branch/master/graph/badge.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/shivammathur/cache-extensions/blob/master/LICENSE\" title=\"license\"\u003e\u003cimg alt=\"LICENSE\" src=\"https://img.shields.io/badge/license-MIT-428f7e.svg?logo=open%20source%20initiative\u0026logoColor=white\u0026labelColor=555555\"\u003e\u003c/a\u003e\n  \u003ca href=\"#tada-php-support\" title=\"PHP Versions Supported\"\u003e\u003cimg alt=\"PHP Versions Supported\" src=\"https://img.shields.io/badge/php-5.3%20to%208.5-777bb3.svg?logo=php\u0026logoColor=white\u0026labelColor=555555\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nCache PHP extensions in [GitHub Actions](https://github.com/features/actions \"GitHub Actions\"). This action has to be used along with [shivammathur/setup-php](https://github.com/shivammathur/setup-php \"Setup PHP\") and [actions/cache](https://github.com/actions/cache \"Cache in GitHub Actions\") GitHub Actions. It configures the environment required to cache PHP extensions. Refer to [Usage](#memo-usage \"How to use this\") section for details and example workflow.\n\n## Contents\n\n- [PHP Support](#tada-php-support)\n- [OS/Platform Support](#cloud-osplatform-support)\n- [Usage](#memo-usage)\n  - [Inputs](#inputs)\n  - [Workflow](#workflow)\n  - [Thread Safe Setup](#thread-safe-setup)\n- [License](#scroll-license)\n- [Contributions](#1-contributions)\n- [Support This Project](#sparkling_heart-support-this-project)\n- [Dependencies](#package-dependencies)\n\n## :tada: PHP Support\n\n|PHP Version|Stability|Release Support|\n|--- |--- |--- |\n|5.3|`Stable`|`End of life`|\n|5.4|`Stable`|`End of life`|\n|5.5|`Stable`|`End of life`|\n|5.6|`Stable`|`End of life`|\n|7.0|`Stable`|`End of life`|\n|7.1|`Stable`|`End of life`|\n|7.2|`Stable`|`End of life`|\n|7.3|`Stable`|`End of life`|\n|7.4|`Stable`|`End of life`|\n|8.0|`Stable`|`End of life`|\n|8.1|`Stable`|`Security fixes only`|\n|8.2|`Stable`|`Security fixes only`|\n|8.3|`Stable`|`Active`|\n|8.4|`Stable`|`Active`|\n|8.5|`Nightly`|`In development`|\n\n## :cloud: OS/Platform Support\n\n| Virtual environment | Arch    | YAML workflow label                |\n|---------------------|---------|------------------------------------|\n| Ubuntu 24.04        | x86_64  | `ubuntu-latest` or `ubuntu-24.04`  |\n| Ubuntu 22.04        | x86_64  | `ubuntu-22.04`                     |\n| Ubuntu 24.04        | aarch64 | `ubuntu-24.04-arm`                 |\n| Ubuntu 22.04        | aarch64 | `ubuntu-22.04-arm`                 |\n| Windows Server 2025 | x64     | `windows-2025`                     |\n| Windows Server 2022 | x64     | `windows-latest` or `windows-2022` |\n| Windows Server 2019 | x64     | `windows-2019`                     |\n| macOS Sequoia 15.x  | arm64   | `macos-15`                         |\n| macOS Sonoma 14.x   | arm64   | `macos-latest` or `macos-14`       |\n| macOS Ventura 13.x  | x86_64  | `macos-13`                         |\n\n**Note**: Support for self-hosted runners for the above operating systems is in beta. If you use this action on a self-hosted runner, please report any issues you find.\n\n## :memo: Usage\n\nUse this GitHub Action when the extensions you are adding in [setup-php](https://github.com/shivammathur/setup-php \"setup-php GitHub Action\") are installed and take a long time to set up. If you are using extensions which have the result `Installed and enabled` in the logs like `pecl` extensions on `Ubuntu` or extensions which have custom support, it is recommended to use this action to cache your extensions.\n\n### Inputs\n\n#### `php-version` (optional)\n\n- Specify the PHP version you want to set up.\n- Accepts a `string`. For example `'8.0'`.\n- Accepts `latest` to set up the latest stable PHP version.\n- Accepts `nightly` to set up a nightly build from the master branch of PHP.\n- Accepts the format `d.x`, where `d` is the major version. For example `5.x`, `7.x` and `8.x`.\n- See [PHP support](#tada-php-support) for the supported PHP versions.\n- If not specified, it looks for `php-version-file` input.\n\n#### `php-version-file` (optional)\n\n- Specify a file with the PHP version you want to set up.\n- Accepts a `string`. For example `'.phpenv-version'`.\n- See [PHP support](#tada-php-support) for the supported PHP versions.\n- By default, `.php-version` file is used.\n- If not specified and the default `.php-version` file is not found, the latest stable PHP version is set up.\n\n#### `extensions` (required)\n\n- Specify the extensions you want to set up.\n- Accepts a `string` in csv-format. For example `mbstring, xdebug, :opcache`.\n- Extensions prefixed with `:` are ignored in output cache key.\n\n#### `key` (required)\n\n- Specify the key to identify the cache version.\n- Accepts any `string`. For example `cache-v1`.\n- Changing this would reset the cache.\n\nSee [action.yml](action.yml \"Metadata for this GitHub Action\") and usage below for more info.\n\n### Workflow\n\n\u003e Cache extensions in a PHP workflow\n\n```yaml\njobs:\n  run:\n    runs-on: ${{ matrix.operating-system }}\n    strategy:\n      matrix:\n        operating-system: [ubuntu-latest, windows-latest, macos-latest]\n        php-versions: ['8.1', '8.2', '8.3']\n    name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}\n    env:\n      extensions: intl, pcov\n      key: cache-v1 # can be any string, change to clear the extension cache.\n    steps:\n    - name: Checkout\n      uses: actions/checkout@v4\n\n    - name: Setup cache environment\n      id: extcache\n      uses: shivammathur/cache-extensions@v1\n      with:\n        php-version: ${{ matrix.php-versions }}\n        extensions: ${{ env.extensions }}\n        key: ${{ env.key }}\n\n    - name: Cache extensions\n      uses: actions/cache@v4\n      with:\n        path: ${{ steps.extcache.outputs.dir }}\n        key: ${{ steps.extcache.outputs.key }}\n        restore-keys: ${{ steps.extcache.outputs.key }}\n\n    - name: Setup PHP\n      uses: shivammathur/setup-php@v2\n      with:\n        php-version: ${{ matrix.php-versions }}\n        extensions: ${{ env.extensions }}\n```\n\n### Thread Safe Setup\n\nIf you set up both `TS` and `NTS` PHP versions in your workflow, please add `${{ env.phpts }}` to `key` and `restore-keys` inputs in `actions/cache` step in the above workflow to avoid a conflicting cache.\n\n```yaml\n- name: Cache extensions\n  uses: actions/cache@v4\n  with:\n    path: ${{ steps.extcache.outputs.dir }}\n    key: ${{ steps.extcache.outputs.key }}-${{ env.phpts }}\n    restore-keys: ${{ steps.extcache.outputs.key }}-${{ env.phpts }}\n```\n\n## :scroll: License\n\nThe code and documentation in this project are under the [MIT License](LICENSE \"License for shivammathur/cache-extensions\"). This project has multiple [dependencies](https://github.com/shivammathur/cache-extensions/network/dependencies \"Dependencies for this PHP Action\"). Their licenses can be found in their respective repositories.\n\n## :+1: Contributions\n\nContributions are welcome! See [Contributor's Guide](.github/CONTRIBUTING.md \"shivammathur/cache-extensions contribution guide\"). If you face any issues while using this or want to suggest a feature/improvement, create an issue [here](https://github.com/shivammathur/cache-extensions/issues \"Issues reported\").\n\n## :sparkling_heart: Support This Project\n\nThis project is generously supported by many users and organisations via [GitHub Sponsors](https://github.com/sponsors/shivammathur).\n\n\u003ca href=\"https://github.com/sponsors/shivammathur\"\u003e\u003cimg src=\"https://setup-php.com/sponsors.svg?\" alt=\"Sponsor shivammathur\"\u003e\u003c/a\u003e\n\n## :package: Dependencies\n\n- [Node.js dependencies](https://github.com/shivammathur/cache-extensions/network/dependencies \"Node.js dependencies\")\n","funding_links":["https://github.com/sponsors/shivammathur"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshivammathur%2Fcache-extensions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshivammathur%2Fcache-extensions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshivammathur%2Fcache-extensions/lists"}