diff --git a/examples/development/php/ds-extension/README.md b/examples/development/php/ds-extension/README.md new file mode 100644 index 00000000000..9bc688c0b02 --- /dev/null +++ b/examples/development/php/ds-extension/README.md @@ -0,0 +1,13 @@ +# PHP with the `ds` extension + +A minimal Devbox project that installs PHP 8.5 and the [`ds`](https://www.php.net/manual/en/book.ds.php) +extension and exercises `\Ds\Seq` from a short PHP script. + +## Run it + +```sh +devbox run run_test +``` + +The script verifies that `ds` is loaded with `extension_loaded('ds')` and then +constructs a `\Ds\Seq`, iterating its elements. diff --git a/examples/development/php/ds-extension/devbox.d/php/php-fpm.conf b/examples/development/php/ds-extension/devbox.d/php/php-fpm.conf new file mode 100644 index 00000000000..b9359574722 --- /dev/null +++ b/examples/development/php/ds-extension/devbox.d/php/php-fpm.conf @@ -0,0 +1,17 @@ +[global] +pid = ${PHPFPM_PID_FILE} +error_log = ${PHPFPM_ERROR_LOG_FILE} +daemonize = yes + +[www] +; user = www-data +; group = www-data +listen = 127.0.0.1:${PHPFPM_PORT} +; listen.owner = www-data +; listen.group = www-data +pm = dynamic +pm.max_children = 5 +pm.start_servers = 2 +pm.min_spare_servers = 1 +pm.max_spare_servers = 3 +chdir = / diff --git a/examples/development/php/ds-extension/devbox.d/php/php.ini b/examples/development/php/ds-extension/devbox.d/php/php.ini new file mode 100644 index 00000000000..b4626d503ab --- /dev/null +++ b/examples/development/php/ds-extension/devbox.d/php/php.ini @@ -0,0 +1,6 @@ +[php] + +; Put your php.ini directives here. For the latest default php.ini file, see https://github.com/php/php-src/blob/master/php.ini-production + +; memory_limit = 128M +; expose_php = Off diff --git a/examples/development/php/ds-extension/devbox.json b/examples/development/php/ds-extension/devbox.json new file mode 100644 index 00000000000..9a0abac42d7 --- /dev/null +++ b/examples/development/php/ds-extension/devbox.json @@ -0,0 +1,11 @@ +{ + "packages": [ + "php@8.5", + "php85Extensions.ds@latest" + ], + "shell": { + "scripts": { + "run_test": "php index.php" + } + } +} diff --git a/examples/development/php/ds-extension/devbox.lock b/examples/development/php/ds-extension/devbox.lock new file mode 100644 index 00000000000..cda3fb019cb --- /dev/null +++ b/examples/development/php/ds-extension/devbox.lock @@ -0,0 +1,106 @@ +{ + "lockfile_version": "1", + "packages": { + "github:NixOS/nixpkgs/nixpkgs-unstable": { + "last_modified": "2026-04-27T06:11:55Z", + "resolved": "github:NixOS/nixpkgs/6368eda62c9775c38ef7f714b2555a741c20c72d?lastModified=1777270315&narHash=sha256-yKB4G6cKsQsWN7M6rZGk6gkJPDNPIzT05y4qzRyCDlI%3D" + }, + "php85Extensions.ds@latest": { + "last_modified": "2026-05-08T21:03:27Z", + "resolved": "github:NixOS/nixpkgs/b3da656039dc7a6240f27b2ef8cc6a3ef3bccae7#php85Extensions.ds", + "source": "devbox-search", + "version": "2.0.0", + "systems": { + "aarch64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/bljpapdpa4amfjbv8nj7dv240xqgqq6y-php-ds-2.0.0", + "default": true + } + ], + "store_path": "/nix/store/bljpapdpa4amfjbv8nj7dv240xqgqq6y-php-ds-2.0.0" + }, + "aarch64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/q2i8szhr19yn31brcymy5rwdyavq94fj-php-ds-2.0.0", + "default": true + } + ], + "store_path": "/nix/store/q2i8szhr19yn31brcymy5rwdyavq94fj-php-ds-2.0.0" + }, + "x86_64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/sspk4hlrds9f7nzmzs2j520fgr5bjq56-php-ds-2.0.0", + "default": true + } + ], + "store_path": "/nix/store/sspk4hlrds9f7nzmzs2j520fgr5bjq56-php-ds-2.0.0" + }, + "x86_64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/hv2x77zg3v0qyhshwz592iiqr8inv0qm-php-ds-2.0.0", + "default": true + } + ], + "store_path": "/nix/store/hv2x77zg3v0qyhshwz592iiqr8inv0qm-php-ds-2.0.0" + } + } + }, + "php@8.5": { + "last_modified": "2026-05-08T21:03:27Z", + "plugin_version": "0.0.3", + "resolved": "github:NixOS/nixpkgs/b3da656039dc7a6240f27b2ef8cc6a3ef3bccae7#php85", + "source": "devbox-search", + "version": "8.5.6", + "systems": { + "aarch64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/5rvi873nrynml14fxp1vjm62hsanyjq2-php-with-extensions-8.5.6", + "default": true + } + ], + "store_path": "/nix/store/5rvi873nrynml14fxp1vjm62hsanyjq2-php-with-extensions-8.5.6" + }, + "aarch64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/46lzqw9gb5asd4d21yx8xx9njzp1mv78-php-with-extensions-8.5.6", + "default": true + } + ], + "store_path": "/nix/store/46lzqw9gb5asd4d21yx8xx9njzp1mv78-php-with-extensions-8.5.6" + }, + "x86_64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/cnjm1ipj0law6766022cbcjg7d1j43a5-php-with-extensions-8.5.6", + "default": true + } + ], + "store_path": "/nix/store/cnjm1ipj0law6766022cbcjg7d1j43a5-php-with-extensions-8.5.6" + }, + "x86_64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/vjvqkq61yamwrmj04cpf1nvrms7xjzhc-php-with-extensions-8.5.6", + "default": true + } + ], + "store_path": "/nix/store/vjvqkq61yamwrmj04cpf1nvrms7xjzhc-php-with-extensions-8.5.6" + } + } + } + } +} diff --git a/examples/development/php/ds-extension/index.php b/examples/development/php/ds-extension/index.php new file mode 100644 index 00000000000..b3937e21aac --- /dev/null +++ b/examples/development/php/ds-extension/index.php @@ -0,0 +1,14 @@ + $elem) { + echo "idx: $idx and elem: $elem\n"; +} +echo "done\n"; diff --git a/testscripts/languages/php.test.txt b/testscripts/languages/php.test.txt index 81247aa58ef..b0553f5a48a 100644 --- a/testscripts/languages/php.test.txt +++ b/testscripts/languages/php.test.txt @@ -1,19 +1,19 @@ exec devbox run php index.php stdout 'done\n' -exec devbox rm php83Extensions.ds +exec devbox rm php85Extensions.ds exec devbox run php index.php stdout 'ds extension is not enabled' -exec devbox add php83Extensions.ds +exec devbox add php85Extensions.ds exec devbox run php index.php stdout 'done\n' -- devbox.json -- { "packages": [ - "php@latest", - "php83Extensions.ds@latest" + "php@8.5", + "php85Extensions.ds@latest" ] } @@ -26,10 +26,10 @@ if (!extension_loaded('ds')) { exit(0); } -$vec = new \Ds\Vector(["hello", "world"]); +$seq = new \Ds\Seq(["hello", "world"]); -echo("Original vector elements\n"); -foreach ($vec as $idx => $elem) { +echo("Original sequence elements\n"); +foreach ($seq as $idx => $elem) { echo("idx: $idx and elem: $elem\n"); } echo("done\n");