Skip to content

Maintenance: dependency updates, root path support, Laravel temporary URLs - #98

Merged
sifex merged 5 commits into
masterfrom
maintenance/update-deps-fix-issues
Aug 15, 2026
Merged

sifex merged 5 commits into
masterfrom
maintenance/update-deps-fix-issues

Conversation

@sifex

@sifex sifex commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Maintenance pass over the v3 line: dependency updates, two open-issue fixes, several latent bugs, and modernized CI/static analysis.

Dependency updates (composer.json)

  • PHP floor ^8.3 — PHP 8.2 reaches EOL on 31 Dec 2026. (Pint 1.x also requires ^8.3.)
  • fzaninotto/faker → fakerphp/faker — abandoned package; drop-in replacement, same Faker\ namespace.
  • laravel/pint ^0.2.3 → ^1.30 — fixes PHP 8.5 deprecation warnings from the old Pint build.
  • phpunit/phpunit ^10.0 → ^11.5 — 10.x is EOL. PHPUnit 12+ is not viable: it removed doc-comment metadata support, which league/flysystem-adapter-test-utilities still relies on (test discovery drops from 158 → 22).

Issue fixes

  • Laravel Storage::temporaryUrl() throws This driver does not support creating temporary URLs although adapter supports temporaryUrl() #97 — Laravel Storage::temporaryUrl() throws "This driver does not support creating temporary URLs": Laravel's FilesystemAdapter only calls getTemporaryUrl() on the adapter; it was never implemented. Added BunnyCDNAdapter::getTemporaryUrl() (accepts DateTimeInterface or minutes, plus signed query-param options) — Storage::disk('bunnycdn')->temporaryUrl() now works out of the box.
  • 'root' setting does not work? #96 / discussion Set root path on config #30 — root setting does not work: the third constructor argument (which previously threw "PrefixPath is no longer supported") is now a real root path prefix — v1 semantics restored. All operations (write/read/list/delete/move/copy/URLs) are scoped to the root; listed paths are root-relative; public and temporary URLs include the root and temporary-URL signatures are built from the root-scoped path. Documented in the README incl. the Laravel root config.

Bugs found during review

  • deleteDirectory('') could DELETE the storage zone root — now guarded with UnableToDeleteDirectory.
  • request() json_decode edge case — a file whose content is numeric (123) or true decoded to int/bool and download() threw a TypeError against its string return type. Non-array JSON payloads now return the raw body.
  • parse_bunny_timestamp() — fatal error on malformed timestamps; now falls back to 0.
  • writeBatch failure reporting — UnableToWriteFile::atLocation() received a numeric pool index instead of the target path.
  • lastModified()/fileSize() relied on a return-type TypeError for directory paths; now an explicit UnableToRetrieveMetadata (same external behavior, flagged by PHPStan).

Tooling / CI

  • PHPStan level 0 → 5 via new phpstan.neon.dist; all reported issues fixed.
  • Tests converted from @test doc-comments to #[Test] attributes (deprecated in PHPUnit 11); import added.
  • New tests/RootTest.php — full flysystem conformance suite against a root-scoped adapter (63 tests) plus targeted root tests.
  • CI (php.yml): checkout@v4, setup-php@v4, PHP matrix 8.3/8.4/8.5, local vendor/bin/phpstan run (guarded so legacy v1/v2 branches — which don't ship pint/phpstan — keep working), codecov-action@v5 replacing the deprecated bash uploader.

Verification

  • 225 tests, 440 assertions — all green (was 158; +63 RootTest conformance, +4 temp-URL tests)
  • composer validate --strict, Pint, PHPStan level 5 — all clean
  • No composer security advisories

Notes

  • composer.lock stays gitignored (library convention).
  • Local stray .git.broken/ directory found in the repo root — untracked, not included in this PR.

… URLs

- Bump PHP floor to ^8.3 (8.2 reaches EOL Dec 2026)
- Replace abandoned fzaninotto/faker with fakerphp/faker (drop-in)
- Bump laravel/pint 0.2 -> 1.30, phpunit 10 -> 11.5 (latest PHPUnit
  compatible with flysystem-adapter-test-utilities; 12+ drops doc-comment
  metadata support)
- Add getTemporaryUrl() to the adapter so Laravel's
  Storage::disk('bunnycdn')->temporaryUrl() works out of the box (fixes #97)
- Restore the third constructor argument as a real 'root' path prefix,
  scoping all operations (upload/read/list/delete/URLs) to a subdirectory
  (fixes #96, discussion #30)
- Prevent accidental deletion of the storage zone root via deleteDirectory('')
- Harden parse_bunny_timestamp against malformed timestamps
- Fix json_decode edge case in client request() (numeric/bool file content
  no longer type-errors on download)
- writeBatch now reports the failing target path instead of a numeric index
- PHPStan: level 0 -> 5 via phpstan.neon.dist; fix reported issues
  (match on mixed IsDirectory, StorageAttributes vs FileAttributes returns)
- Convert @test doc-comments to #[Test] attributes (deprecated in PHPUnit 11)
- CI: checkout@v4, setup-php@v4, local phpstan run, codecov-action@v5,
  PHP matrix 8.3-8.5, guarded steps keep legacy v1/v2 branches working
- README: PHP badge, root path + temporaryUrl documentation

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Maintenance update for the Flysystem v3 BunnyCDN adapter: modernizes dependencies/tooling and restores a root-path prefix feature while improving temporary URL support for Laravel integrations.

Changes:

  • Updated dependency floor/tooling (PHP ^8.3, PHPUnit 11.5, Pint 1.x, PHPStan config + CI integration).
  • Added adapter root-path scoping and expanded test coverage (new RootTest + updated test suite).
  • Added Laravel-compatible temporary URL entrypoint (getTemporaryUrl) and expanded temporary URL tests.

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/UtilityClassTest.php Migrates tests to PHPUnit 11 #[Test] attributes.
tests/TemporaryUrlTest.php Adds coverage for Laravel-compatible temp URLs, options, and root-scoped signing.
tests/RootTest.php New conformance + targeted tests for a root-scoped adapter.
tests/PrefixTest.php Updates tests for PHPUnit 11 attributes and root-argument semantics.
tests/MockClient.php Minor PHP 8+/style modernizations and docblock cleanup.
tests/FlysystemAdapterTest.php Updates tests for PHPUnit 11 attributes and config instantiation style.
tests/ClientTest.php Adjusts import ordering for PHPUnit function import.
src/WriteBatchFile.php Simplifies constructor to promoted-properties shorthand.
src/Util.php Docblock cleanup (no functional change).
src/Exceptions/NotFoundException.php Class formatting simplification.
src/Exceptions/BunnyCDNException.php Class formatting simplification.
src/BunnyCDNClient.php Improves request() decoding behavior to avoid non-array JSON type pitfalls.
src/BunnyCDNAdapter.php Implements root scoping, Laravel temp URL compatibility, and several bug fixes.
readme.md Documents root support and Laravel temporary URL usage/config.
phpunit.xml Updates PHPUnit schema reference for PHPUnit 11.5.
phpstan.neon.dist Adds PHPStan level 5 baseline config.
composer.json Updates PHP requirement and development tooling dependencies.
.gitignore Adds PHPStan cache directory.
.github/workflows/php.yml Updates CI matrix/tooling and adds guarded Pint/PHPStan execution.
Suppressed comments (1)

.github/workflows/php.yml:41

  • Same indentation issue for the remaining steps entries: they need to be nested under steps: (two spaces deeper than the key).
    - name: Install dependencies
      run: composer install --prefer-dist --no-progress --no-interaction

    - name: Run linter
      run: test -f vendor/bin/pint && vendor/bin/pint -v --test || echo 'pint not installed, skipping'

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/BunnyCDNAdapter.php Outdated
Comment thread src/BunnyCDNAdapter.php
Comment thread src/BunnyCDNAdapter.php Outdated
Comment thread .github/workflows/php.yml Outdated
@sifex
sifex merged commit 66b40dc into master Aug 15, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants