@php-wasm/universal
Index
Classes
Functions
- applyRewriteRules
- consumeAPI
- consumeAPISync
- createObjectPoolProxy
- ensurePathPrefix
- exposeAPI
- exposeSyncAPI
- getPhpIniEntries
- inferMimeType
- isExitCode
- isPathToSharedFS
- iterateFiles
- loadPHPRuntime
- popLoadedRuntime
- prettyPrintFullStackTrace
- printDebugDetails
- printResponseDebugDetails
- proxyFileSystem
- removePathPrefix
- rotatePHPRuntime
- sandboxedSpawnHandlerFactory
- setPhpIniEntries
- toRelativeUrl
- withPHPIniValues
- writeFiles
- writeFilesStreamToPhp
Interfaces
Namespaces
References
Type Aliases
- ByteRange
- ConflictingLockedRange
- DataModule
- EmscriptenOptions
- Fd
- FileLockManager
- FileNotFoundAction
- FileNotFoundGetActionCallback
- FileNotFoundToInternalRedirect
- FileNotFoundToResponse
- HTTPMethod
- IterateFilesOptions
- LockedRange
- MessageListener
- MountHandler
- PHPEvent
- PHPEventListener
- PHPFactory
- PHPFactoryOptions
- PHPLoaderModule
- PHPRequestHandlerConfiguration
- PHPRequestHeaders
- PHPRuntime
- PHPRuntimeId
- Path
- PathAlias
- Pid
- Pooled
- PublicAPI
- Remote
- RemoteAPI
- RequestedRangeLock
- RewriteRule
- RuntimeType
- SpawnHandler
- SupportedPHPVersion
- UniversalPHP
- UnmountFunction
- WholeFileLock
- WholeFileLockOp
- WholeFileLock_Exclusive
- WholeFileLock_Shared
- WholeFileLock_Unlocked
- WithIsReady
Variables
References
SpawnedPHP
WithAPIState
Type Aliases
ByteRange
Type declaration
end: bigint
start: bigint
ConflictingLockedRange
DataModule
Type declaration
default: (phpRuntime: PHPRuntime) => void
Parameters
phpRuntime: PHPRuntime
Returns void
dependenciesTotalSize: number
dependencyFilename: string
EmscriptenOptions
Fd
FileLockManager
Type declaration
findFirstConflictingByteRangeLock: (path: Path, desiredLock: RequestedRangeLock) => Omit<RequestedRangeLock, fd> | undefined
Get the first lock that would conflict with the specified lock.
This method is meant to satisfy the needs of the F_GETLK fcntl() command. https://sourceware.org/glibc/manual/2.41/html_node/File-Locks.html#index-F_005fGETLK-1
Parameters
path: Path
The path of the file to check for conflicts. This should be the path of the file in the underlying filesystem.
desiredLock: RequestedRangeLock
The lock to check for conflicts.
Returns Omit<RequestedRangeLock, fd> | undefined
lockFileByteRange: (path: Path, requestedLock: RequestedRangeLock, waitForLock: boolean) => boolean
Update the lock on a byte range of a file.
This method is for locking with the F_SETLK fcntl() command. https://sourceware.org/glibc/manual/2.41/html_node/File-Locks.html#index-F_005fSETLK-1
Parameters
path: Path
The path of the file to lock. This should be the path of the file in the underlying filesystem.
requestedLock: RequestedRangeLock
The lock to request, including start, end, type, and pid.
waitForLock: boolean
Whether to block until the lock is acquired.
Returns boolean
lockWholeFile: (path: Path, op: WholeFileLockOp) => boolean
Update the lock on the whole file.
This method is for updating the lock on the whole file with the F_SETLKW fcntl() command. https://sourceware.org/glibc/manual/2.41/html_node/File-Locks.html#index-F_005fSETLKW-1
Parameters
path: Path
The path of the file to lock. This should be the path of the file in the underlying filesystem.
op: WholeFileLockOp
The operation to perform, including 'shared', 'exclusive', or 'unlock'.
Returns boolean
releaseLocksForProcess: (pid: number) => void
Release all locks for a given process.
Used when a process exits or is otherwise terminated.
Parameters
pid: number
The PID of the process that wants to release the locks.
Returns void
releaseLocksOnFdClose: (pid: number, fd: number, path: Path) => void
Release all locks for the given process and file descriptor.
Parameters
pid: number
The process ID to release locks for.
fd: number
The file descriptor to release locks for.
path: Path
The path to the file to release locks for. This should be the path of the file in the underlying filesystem.
Returns void
FileNotFoundAction
FileNotFoundGetActionCallback
Type declaration
Parameters
relativePath: string
Returns FileNotFoundAction
FileNotFoundToInternalRedirect
Type declaration
type: internal-redirect
uri: string
FileNotFoundToResponse
Type declaration
response: PHPResponse
type: response
HTTPMethod
IterateFilesOptions
Type declaration
optionalexceptPaths?: string[]
A list of paths to exclude from the results.
optionalpathPrefix?: string
A prefix to add to all paths. Only used if
relativePathsis true.optionalrelativePaths?: boolean
Should yield paths relative to the root directory? If false, all paths will be absolute.
LockedRange
MessageListener
Type declaration
Parameters
data: string
Returns Promise<string | Uint8Array | void> | string | void
MountHandler
Type declaration
Parameters
php: PHP
FS: Emscripten.RootFS
vfsMountPoint: string
Returns UnmountFunction | Promise<UnmountFunction>
PHPEvent
Represents an event related to the PHP instance. This is intentionally not an extension of CustomEvent to make it isomorphic between different JavaScript runtimes.
PHPEventListener
PHPFactory
Type declaration
Parameters
options: PHPFactoryOptions
Returns Promise<PHP>
PHPFactoryOptions
Type declaration
isPrimary: boolean
PHPLoaderModule
Type declaration
dependenciesTotalSize: number
dependencyFilename: string
init: (jsRuntime: string, options: EmscriptenOptions) => PHPRuntime
Parameters
jsRuntime: string
options: EmscriptenOptions
Returns PHPRuntime
PHPRequestHandlerConfiguration
PHPRequestHeaders
PHPRuntime
PHPRuntimeId
Path
PathAlias
Maps a URL path prefix to an absolute filesystem path.
Similar to Nginx's alias directive or Apache's Alias directive.
Type declaration
fsPath: string
The absolute filesystem path to serve files from.
urlPrefix: string
The URL path prefix to match (e.g., '/phpmyadmin').
Pid
Pooled
The type returned by createObjectPoolProxy. All method calls and
property accesses are wrapped in promises because acquiring a free
pool instance is inherently async.
Dispose/asyncDispose symbols are omitted because the pool proxy forwards calls to a single random instance — disposing one instance out of the pool is never the intended behavior. Pool lifecycle should be managed by the code that created the pool.
Type parameters
- T: object
PublicAPI
Type parameters
- Methods
- PipedAPI = unknown
Remote
Takes the raw type of a remote object, function or class in the other thread and returns the
type as it is visible to the local thread from the proxy return value of Comlink.wrap() or
Comlink.proxy().
Type parameters
- T
RemoteAPI
Type parameters
- T
RequestedRangeLock
RewriteRule
Type declaration
match: RegExp
replacement: string
RuntimeType
SpawnHandler
Type declaration
Parameters
command: string
args: string[]
Returns ChildProcess
SupportedPHPVersion
UniversalPHP
UnmountFunction
WholeFileLock
WholeFileLockOp
WholeFileLock_Exclusive
WholeFileLock_Shared
WholeFileLock_Unlocked
Type declaration
type: unlocked
WithIsReady
Type declaration
isConnected: () => Promise<void>
Resolves to true when the remote API is ready for Comlink communication, but not necessarily fully initialized yet.
Returns Promise<void>
isReady: () => Promise<void>
Resolves to true when the remote API is declares it's fully loaded and ready to be used.
Returns Promise<void>
Variables
constDEFAULT_BASE_URL
The default base used to convert a path into the URL object.
This is an interface used to abstract byte range locking like fcntl() and whole-file locking like flock().