amphp/file
Non-blocking access to the filesystem based on Amp and Revolt.
v4.0.0
3.5M downloads/mo
#3381 most downloaded on Packagist
amphp/file
What this package is like to depend on
Last release 3 months ago
09 May 2026
Release timing varies
gaps range from 1 weeks to 1.3 years
Rarely documented
notes for 7 of 30 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
37 releases · first in 2015
1 release in the last 12 months
see the full history below
Release timeline
37 releases · Sep 2015 to May 2026Releases
latest 37-
v4.0.009 May 2026Release notes
Open source →Users of
3.xshould be able to update to4.xwithout code changes unless their application did one of the following:- Defined a custom
Fileimplementation - Initialized
ParallelFilesystemDriverwith a custom worker count.
Breaking Changes
This release adds a
lock(),tryLock(), andunlock()to theFileinterface. These methods provide a non-blocking means of locking and unlocking a file.File::lock(): Non-blocking method to obtain a shared or exclusive lock on the file. This method must only return once the lock has been obtained.File::tryLock(): Makes a single non-blocking attempt to obtain a shared or exclusive lock on the file. Returns true if the lock was obtained, otherwise false.File::unlock(): Unlocks the file if the lock is currently held.
In
3.x, the constructor ofParallelFilesystemDriveraccepted an optionalWorkerPooland a number of workers to use from that pool. In4.x, instead the constructor now requires only an optionalLimitedWorkerPool(a new pool is created if one is not provided). The number of workers used for opening files is determined by the value returned fromLimitedWorkerPool::getWorkerLimit(). Use aDelegateWorkerPoolif you wish to use an existing pool and limit the number of workers used from the pool to open files. In general, it is not necessary to customize the parallel filesystem driver.
Full Changelog: v3.2.0...v4.0.0-beta.1
Release notes
Open source →Users of
3.xshould be able to update to4.xwithout code changes unless their application did one of the following:- Defined a custom
Fileimplementation - Initialized
ParallelFilesystemDriverwith a custom worker count.
Breaking Changes
This release adds a
lock(),tryLock(), andunlock()to theFileinterface. These methods provide a non-blocking means of locking and unlocking a file.File::lock(): Non-blocking method to obtain a shared or exclusive lock on the file. This method must only return once the lock has been obtained.File::tryLock(): Makes a single non-blocking attempt to obtain a shared or exclusive lock on the file. Returns true if the lock was obtained, otherwise false.File::unlock(): Unlocks the file if the lock is currently held.
In
3.x, the constructor ofParallelFilesystemDriveraccepted an optionalWorkerPooland a number of workers to use from that pool. In4.x, instead the constructor now requires only an optionalLimitedWorkerPool(a new pool is created if one is not provided). The number of workers used for opening files is determined by the value returned fromLimitedWorkerPool::getWorkerLimit(). Use aDelegateWorkerPoolif you wish to use an existing pool and limit the number of workers used from the pool to open files. In general, it is not necessary to customize the parallel filesystem driver.
Full Changelog: v3.2.0...v4.0.0
- Defined a custom
-
v4.0.0-beta.110 Jan 2025 pre-releaseNothing published for this version
-
v3.2.006 Dec 2024Release notes
Open source →What's Changed
- The parallel driver no longer reuses the global worker pool if a specific instance is not provided to the constructor. Instead, a new worker pool is created.
- The
$workerLimitparameter to the constructor ofParallelFilesystemDriveris now deprecated. Pass an instance ofLimitedWorkerPoolinstead.
Full Changelog: v3.1.1...v3.2.0
-
v3.1.115 Aug 2024Release notes
Open source →What's Changed
- Dropped support for ext-uv < 0.3.0.
- Changed the version check for ext-uv to avoid an ext-opcache bug (see amphp/http-client#365).
Full Changelog: v3.1.0...v3.1.1
-
v3.1.021 Apr 2024Release notes
Open source →What's Changed
- Add
FileCacheclass by @Nadyita in #83 - Add
KeyedFileMutexby @bwoebi in #62 - Made implicit nullable types explicit to avoid deprecation notice in PHP 8.4
New Contributors
Full Changelog: v3.0.2...v3.1.0
- Add
-
v3.0.227 Dec 2023Release notes
Open source →What's Changed
- Fixed detecting if a file is writing from the file mode when
r+(or similar) is used as the mode. (#77) - Fixed assertion failing during shutdown destruction of
ParallelFilesystemDriver. (#81)
Full Changelog: v3.0.1...v3.0.2
- Fixed detecting if a file is writing from the file mode when
-
v3.0.123 Jul 2023Release notes
Open source →What's Changed
- Fix
touch()on non-existent files in ext-uv and ext-eio by @kelunik (#73) - Fix
write()truncation with ext-uv and ext-eio by @danog in (#76)
Full Changelog: v3.0.0...v3.0.1
- Fix
-
v3.0.002 Mar 2023Release notes
Open source →Stable release compatible with AMPHP v3 and fibers! 🎉
As with other libraries compatible with AMPHP v3, most cases of parameters or returns of
Promise<ResolutionType>have been replaced withResolutionType.- Renamed
BlockingDrivertoBlockingFilesystemDriver - Renamed
EioDrivertoEioFilesystemDriver - Renamed
ParallelDrivertoParallelFilesystemDriver - Renamed
StatusCachingDrivertoStatusCachingFilesystemDriver - Renamed
UvDrivertoUvFilesystemDriver - Renamed
Amp\File\Sync\AsyncFileMutextoAmp\File\FileMutex - Added
?Cancellationas first parameter ofFile::read() - Added
File::isSeekable() - Removed
File::SEEK_SET,File::SEEK_CUR, andFile::SEEK_END - Added
Amp\File\Whencefor seeking instead
Release notes
Open source →- Fixed compatibility with
v2.0ofamphp/byte-streamby updatingFileimplementations to also implementTraversable.
Release notes
Open source →- Fixed
PendingOperationErrorbeing thrown after several seek-then-write operations inUvFileandEioFile.
- Renamed
-
v3.0.0-beta.608 Jan 2023 pre-releaseNothing published for this version
-
v3.0.0-beta.518 Nov 2022 pre-releaseNothing published for this version
-
v3.0.0-beta.407 Nov 2022 pre-releaseNothing published for this version
-
v3.0.0-beta.308 Sep 2022 pre-releaseNothing published for this version
-
v3.0.0-beta.228 Mar 2022 pre-releaseNothing published for this version
-
v3.0.0-beta.109 Feb 2022 pre-releaseNothing published for this version
-
v2.0.408 Sep 2022Nothing published for this version
-
v2.0.308 Feb 2022Nothing published for this version
-
v2.0.220 Sep 2021Nothing published for this version
-
v2.0.112 Jul 2021Nothing published for this version
-
v2.0.021 Jun 2021Nothing published for this version
-
v1.0.214 Jul 2020Nothing published for this version
-
v1.0.110 Jul 2020Nothing published for this version
-
v1.0.014 Sep 2019Nothing published for this version
-
v0.3.501 Mar 2019Nothing published for this version
-
v0.3.401 Mar 2019Nothing published for this version
-
v0.3.328 Oct 2018Nothing published for this version
-
v0.3.227 Oct 2018Nothing published for this version
-
v0.3.117 Mar 2018Nothing published for this version
-
v0.3.015 Dec 2017Nothing published for this version
-
v0.2.421 Jul 2017Nothing published for this version
-
v0.2.318 Jul 2017Nothing published for this version
-
v0.2.206 Jul 2017Nothing published for this version
-
v0.2.123 Jun 2017Nothing published for this version
-
v0.2.022 Jun 2017Nothing published for this version
-
v0.1.301 Oct 2016Nothing published for this version
-
v0.1.224 Mar 2016Nothing published for this version
-
v0.1.108 Feb 2016Nothing published for this version
-
v0.1.010 Sep 2015Nothing published for this version