WebPHP
Hierarchy
- BasePHP
- WebPHP
Index
Properties
Accessors
Methods
- [dispose]
- addEventListener
- chdir
- defineConstant
- dispatchEvent
- exit
- fileExists
- hotSwapPHPRuntime
- initializeRuntime
- internalUrlToPath
- isDir
- listFiles
- mkdir
- mkdirTree
- mv
- onMessage
- pathToInternalUrl
- readFileAsBuffer
- readFileAsText
- removeEventListener
- request
- rmdir
- run
- setPhpIniEntry
- setPhpIniPath
- setSapiName
- setSpawnHandler
- unlink
- writeFile
- load
- loadRuntime
Properties
optionalrequestHandler
semaphore
Accessors
absoluteUrl
Returns string
documentRoot
Returns string
Methods
[dispose]
Returns void
addEventListener
Parameters
eventType: request.end | request.error | runtime.initialized | runtime.beforedestroy
listener: PHPEventListener
Returns void
chdir
Parameters
path: string
Returns void
defineConstant
Parameters
key: string
value: null | string | number | boolean
Returns void
dispatchEvent
Type parameters
- Event: PHPEvent
Parameters
event: Event
Returns void
exit
Parameters
code: number = 0
Returns void
fileExists
Parameters
path: string
Returns boolean
hotSwapPHPRuntime
Hot-swaps the PHP runtime for a new one without interrupting the operations of this PHP instance.
Parameters
runtime: number
optionalcwd: string
Returns void
initializeRuntime
Parameters
runtimeId: number
Returns void
internalUrlToPath
Parameters
internalUrl: string
Returns string
isDir
Parameters
path: string
Returns boolean
listFiles
Parameters
path: string
options: ListFilesOptions = ...
Returns string[]
mkdir
Parameters
path: string
Returns void
mkdirTree
Parameters
path: string
Returns void
mv
Parameters
fromPath: string
toPath: string
Returns void
onMessage
Parameters
listener: MessageListener
Returns Promise<void>
pathToInternalUrl
Parameters
path: string
Returns string
readFileAsBuffer
Parameters
path: string
Returns Uint8Array
readFileAsText
Parameters
path: string
Returns string
removeEventListener
Parameters
eventType: request.end | request.error | runtime.initialized | runtime.beforedestroy
listener: PHPEventListener
Returns void
request
Do not use. Use new PHPRequestHandler() instead.
Parameters
request: PHPRequest
Returns Promise<PHPResponse>
rmdir
Parameters
path: string
options: RmDirOptions = ...
Returns void
run
Parameters
request: PHPRunOptions
Returns Promise<PHPResponse>
setPhpIniEntry
Parameters
key: string
value: string
Returns void
setPhpIniPath
Parameters
path: string
Returns void
setSapiName
Parameters
newName: string
Returns Promise<void>
setSpawnHandler
Parameters
handler: string | SpawnHandler
Returns Promise<void>
unlink
Parameters
path: string
Returns void
writeFile
Parameters
path: string
data: string | Uint8Array
Returns void
staticload
Creates a new PHP instance.
Dynamically imports the PHP module, initializes the runtime, and sets up networking. It’s a shorthand for the lower-level functions like
getPHPLoaderModule
,loadPHPRuntime
, andPHP.initializeRuntime
Parameters
phpVersion: 8.3 | 8.2 | 8.1 | 8.0 | 7.4 | 7.3 | 7.2 | 7.1 | 7.0
The PHP Version to load
options: PHPWebLoaderOptions = {}
The options to use when loading PHP
Returns Promise<WebPHP>
A new PHP instance
staticloadRuntime
Parameters
phpVersion: 8.3 | 8.2 | 8.1 | 8.0 | 7.4 | 7.3 | 7.2 | 7.1 | 7.0
options: PHPWebLoaderOptions = {}
Returns Promise<number>
An exclusive lock that prevent multiple requests from running at the same time.