{"id":13615954,"url":"https://github.com/loophp/nix-shell","last_synced_at":"2025-04-04T10:03:48.357Z","repository":{"id":36987341,"uuid":"378579961","full_name":"loophp/nix-shell","owner":"loophp","description":"Nix shells for PHP development","archived":false,"fork":false,"pushed_at":"2024-10-28T00:40:40.000Z","size":1140,"stargazers_count":155,"open_issues_count":4,"forks_count":9,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-30T06:56:57.820Z","etag":null,"topics":["experimental","nix","shell"],"latest_commit_sha":null,"homepage":null,"language":"Nix","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/loophp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"drupol"}},"created_at":"2021-06-20T06:59:35.000Z","updated_at":"2024-10-23T06:49:30.000Z","dependencies_parsed_at":"2023-02-19T03:15:32.666Z","dependency_job_id":"52586906-3bd3-4603-b0b0-42422db27728","html_url":"https://github.com/loophp/nix-shell","commit_stats":{"total_commits":448,"total_committers":7,"mean_commits":64.0,"dds":0.4263392857142857,"last_synced_commit":"fd9bf8fb06d16cadb215cbc8be04730a0bc7f61f"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loophp%2Fnix-shell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loophp%2Fnix-shell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loophp%2Fnix-shell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loophp%2Fnix-shell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loophp","download_url":"https://codeload.github.com/loophp/nix-shell/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247149503,"owners_count":20891954,"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":["experimental","nix","shell"],"created_at":"2024-08-01T20:01:21.175Z","updated_at":"2025-04-04T10:03:48.335Z","avatar_url":"https://github.com/loophp.png","language":"Nix","funding_links":["https://github.com/sponsors/drupol"],"categories":["Nix","Programming Languages"],"sub_categories":[],"readme":"[![GitHub stars][github stars]][1]\n[![Donate!][donate github]][5]\n\n# Nix shell\n\n![Tutorial](./docs/readme.gif \"Tutorial\")\n\n## Description\n\nThis package provides a `Nix flake` ready to use\nfor PHP development, using the [`Nix` package manager][50]\nwhich can be installed on (_almost_) any operating system.\n\nEach available environment provides the following tools:\n\n- Composer,\n- Symfony CLI,\n- SQLite\n\nAvailable stable PHP versions from `5.6` to `8.3`. But also weekly builds from\nthe following branches:\n\n- `PHP-8.1`\n- `PHP-8.2`\n- `PHP-8.3`\n- `master` (*future 8.4*)\n\nTo list the available PHP versions, run:\n\n```shell\nnix flake show github:loophp/nix-shell\n```\n\nThe PHP extensions to use are automatically inferred from the `composer.json`\nfile.\n\n```json\n...8\u003c...\n\n\"require\": {\n  \"ext-intl\": \"*\",\n},\n\"require-dev\": {\n  \"ext-xdebug\": \"*\",\n  \"ext-pcov\": \"*\",\n}\n\n...\u003e8...\n```\n\nTo load extensions from the `require` and `required-dev` sections, using the flag\n`--impure` is required. Example:\n\n```shell\nnix shell github:loophp/nix-shell#php82 --impure\n```\n\nWe use [Cachix](https://app.cachix.org/cache/nix-shell) to store binaries of the\nbuilt packages. Install it as described in its [docs](https://docs.cachix.org/)\nand then add the cache using `cachix use nix-shell` if you want to avoid\nbuilding those PHP packages yourself.\n\n```shell\ncachix use nix-shell\n```\n\nThis project also provides a basic template for PHP projects, to use it, run:\n\n```shell\nnix flake init --template github:loophp/nix-shell#basic\n```\n\n## Usage\n\nWhile being extremely stable for years, \"[flake][nix flake]\" is an upcoming\nfeature of the Nix package manager. In order to use it, you must explicitly\nenable it, please check the documentation to enable it, this is currently an\nopt-in option.\n\n### In a shell\n\nTo work with PHP 8.1 only:\n\n```shell\nnix shell github:loophp/nix-shell#php81\n```\n\nor with PHP 8.1 and a couple of useful tools:\n\n```shell\nnix shell github:loophp/nix-shell#env-php81\n```\n\nSince the 14th of November 2022, PHP is in `NTS` mode by default (see\n[#154774](https://github.com/NixOS/nixpkgs/issues/154774)).\n\nTo list the available PHP versions and environments, run:\n\n  ```shell\n  nix flake show github:loophp/nix-shell\n  ```\n\n### In another flake\n\n\u003cdetails\u003e\n\n\u003csummary\u003eStep 1\u003c/summary\u003e\n\nImport the input:\n\n```nix\n  inputs = {\n    nixpkgs.url = \"github:NixOS/nixpkgs/nixpkgs-unstable\";\n    flake-utils.url = \"github:numtide/flake-utils\";\n    phps.url = \"github:loophp/nix-shell\";\n  };\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eStep 2\u003c/summary\u003e\n\nImport the overlay:\n\n```nix\npkgs = import inputs.nixpkgs {\n    inherit system;\n    overlays = [\n        inputs.phps.overlays.default\n    ];\n};\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eStep 3\u003c/summary\u003e\n\nUse the packages:\n\n```nix\n    # PHP 8.1 environment\n    pkgs.env-php81\n```\n\n\u003c/details\u003e\n\nTo create your own version of PHP, use the available API function `buildPhpFromComposer`.\n\n### With direnv\n\n`direnv` is an extension for your shell. It augments existing shells with a new\nfeature that can load and unload environment variables depending on the current\ndirectory. You can use it within Nix ([nix-direnv][nix direnv]) and load a\ndevelopment environment just by changing directory.\n\nEdit the file `.envrc` and add the following line:\n\n```\nuse flake github:loophp/nix-shell#env-php-master-snapshot --impure\n```\n\nAnd it's done.\n\n### Customize PHP\n\nTo customize the PHP configuration, you can do it like this:\n\n```shell\nnix shell github:loophp/nix-shell#php81\nphp -c /path/to/the/config.ini \u003c\u003ccommand\u003e\u003e\n```\n\n[Another option][doc .user.ini] would be to create a `.user.ini` file within\nyour current working directory before running the PHP environment, as such:\n\n```ini\nmax_execution_time = 0\nmemory_limit = 2048M\n```\n\nThen run:\n\n```shell\nnix shell github:loophp/nix-shell#php82 --impure\n```\n\nThe `--impure` flag is important to make sure that your custom\n`.user.ini` file is correctly taken in account.\n\n## Contributing\n\nFeel free to contribute by sending pull requests. We are a\nusually very responsive team and we will help you going\nthrough your pull request from the beginning to the end.\n\nFor some reasons, if you can't contribute to the code and are\nwilling to help, sponsoring is a good, sound, and safe way\nto show us some gratitude for the hours we invested in this\npackage.\n\nSponsor me on [Github][5] and/or any of [the contributors][6].\n\n## Thanks\n\n- [Jan Tojnar][47] for assisting me into incorporating his [own package][48].\n- [Aaron Anderse][52] for improving the code and giving some tips.\n\n## Changelog\n\nSee [CHANGELOG.md][43] for a changelog based on [git commits][44].\n\nFor more detailed changelogs, please check [the release changelogs][45].\n\n[1]: https://packagist.org/packages/loophp/nix-shell\n[latest stable version]: https://img.shields.io/packagist/v/loophp/nix-shell.svg?style=flat-square\n[github stars]: https://img.shields.io/github/stars/loophp/nix-shell.svg?style=flat-square\n[total downloads]: https://img.shields.io/packagist/dt/loophp/nix-shell.svg?style=flat-square\n[github workflow status]: https://img.shields.io/github/workflow/status/loophp/nix-shell/Unit%20tests?style=flat-square\n[code quality]: https://img.shields.io/scrutinizer/quality/g/loophp/nix-shell/master.svg?style=flat-square\n[3]: https://scrutinizer-ci.com/g/loophp/nix-shell/?branch=master\n[type coverage]: https://img.shields.io/badge/dynamic/json?style=flat-square\u0026color=color\u0026label=Type%20coverage\u0026query=message\u0026url=https%3A%2F%2Fshepherd.dev%2Fgithub%2Floophp%2Fcollection%2Fcoverage\n[4]: https://shepherd.dev/github/loophp/nix-shell\n[code coverage]: https://img.shields.io/scrutinizer/coverage/g/loophp/nix-shell/master.svg?style=flat-square\n[license]: https://img.shields.io/packagist/l/loophp/nix-shell.svg?style=flat-square\n[donate github]: https://img.shields.io/badge/Sponsor-Github-brightgreen.svg?style=flat-square\n[donate paypal]: https://img.shields.io/badge/Sponsor-Paypal-brightgreen.svg?style=flat-square\n[34]: https://github.com/loophp/nix-shell/issues\n[2]: https://github.com/loophp/nix-shell/actions\n[35]: http://www.phpspec.net/\n[36]: https://github.com/phpro/grumphp\n[37]: https://github.com/infection/infection\n[38]: https://github.com/phpstan/phpstan\n[39]: https://github.com/vimeo/psalm\n[5]: https://github.com/sponsors/drupol\n[6]: https://github.com/loophp/nix-shell/graphs/contributors\n[43]: https://github.com/loophp/nix-shell/blob/master/CHANGELOG.md\n[44]: https://github.com/loophp/nix-shell/commits/master\n[45]: https://github.com/loophp/nix-shell/releases\n[46]: https://nixos.org/guides/nix-pills/developing-with-nix-shell.html\n[47]: https://github.com/jtojnar\n[48]: https://github.com/fossar/nix-phps\n[50]: https://nixos.org/download.html\n[52]: https://github.com/aanderse\n[doc .user.ini]: https://www.php.net/manual/en/configuration.file.per-user.php\n[nix flake]: https://nixos.wiki/wiki/Flakes\n[nix direnv]: https://github.com/nix-community/nix-direnv\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floophp%2Fnix-shell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floophp%2Fnix-shell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floophp%2Fnix-shell/lists"}