Download the PHP package esperecyan/webidl without Composer

On this page you can find all versions of the php package esperecyan/webidl. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package webidl

English / 日本語

Web IDL

Provides the utility class for casting a given value in accordance with WebIDL (Web IDL) type to help with PHP type declarations.

Description

This library makes type declarations help API and the exceptions defined by Web IDL available in PHP. This library is for Web standards API implementors and is not intended to be used directly by a PHP project.

If you want your users to install this library simultaneously with your library, append "esperecyan/webidl": "^2.1.0" to require property in composer.json of your library, such as the following.

For details of Composer, see Composer documentation.

Example

The above example will throw the chained exceptions:

For actual examples, see the source code of esperecyan/url.

Type declarations help API

All of the methods are static, and must be called from a class method.

esperecyan\webidl\TypeHinter::to($type, $value, $argNum, $pseudoTypes)

Converts a given value in accordance with a given IDL type. If the value is not castable, it will throw a DomainException or InvalidArgumentException including a message with method name etc.

string $type

Pass the IDL type (for example, USVString).

mixed $value

Pass the value being converted.

string $argNum = 0

Pass the argument offset that received the value being converted. Arguments are counted starting from zero. This argument value is used by a exception message. If the caller method is __set(), this argument is ignored.

(string|string[]|array)[] $pseudoType = []

Pass the associative array with the identifiers of callback interface types, enumeration types, callback function types or dictionary types (the strings passed in $type) as key. The corresponding values have the following structure.

esperecyan\webidl\TypeHinter::throwReadonlyException()

Throws an exception with a message that represents a read-only property. Must call from __set() method.

esperecyan\webidl\TypeHinter::triggerVisibilityErrorOrDefineProperty()

If a user tries setting to a private or protected property, it will trigger a fatal error. If a user tries setting to a non-existing property, it will create a new public property. Must call from __set() method.

esperecyan\webidl\TypeHinter::triggerVisibilityErrorOrUndefinedNotice()

If a user tries setting to a private or protected property, it will trigger a fatal error. If a user tries getting to a non-existing property, it will trigger a notice. Must call from __get() method.

The correspondence table of the types

Web IDL PHP Additional notes
boolean Booleans
byte
octet
short
unsigned short
long
Integers
unsigned long Integers|Floating point numbers On 32bit PHP or PHP 5.6 or earlier for Windows, a number less than -2147483648 or greater than 2147483647 is the floating point number.
long long Integers|Floating point numbers -9223372036854775808 to 9223372036854775807. However, on 32bit PHP or PHP 5.6 or earlier for Windows, -9007199254740991 to 9007199254740991, and the number less than -2147483648 or greater than 2147483647 is the floating point number.
unsigned long long Integers|Floating point numbers 0 to 9223372036854775807. However, on 32bit PHP or PHP 5.6 or earlier for Windows, 0 to 9007199254740991, and the number greater than 2147483647 is the floating point number.
float unrestricted double Floating point numbers float and unrestricted float is aliases of double and unrestricted double.
DOMString
USVString
Strings A valid UTF-8 string.
ByteString Strings
object Objects
Interface types Objects|Callables If an interface is single operation callback interface, there are cases where the PHP type is Callable.
Dictionary types Arrays An array conforming the structure passed in $pseudoType.
Enumeration types Strings A element of the array passed in $pseudoType, or a constant value of the class passed in.
Callback function types Callables
Sequences
Frozen arrays
Arrays New array.
record\<K, V> esperecyan\webidl\Record
Promise types Not supported. Instead, pass a fully qualified class name or interface name (for example, React\Promise\PromiseInterface).
Union types mixed A return value of UnionType::toUnion().
Error esperecyan\webidl\Error|DOMException
DOMException DOMException
Buffer source types Not supported. Instead, pass a fully qualified class name or interface name.

*1 double should be used rather than float. Deprecated.

The correspondence table of the exceptions

Web IDL PHP
Error *2 esperecyan\webidl\Error interface (If you need to construct an exception having this error name, write new esperecyan\webidl\ErrorClass('error message'))
EvalError esperecyan\webidl\EvalError class
RangeError esperecyan\webidl\RangeError class
ReferenceError esperecyan\webidl\ReferenceError class
TypeError esperecyan\webidl\TypeError class
URIError esperecyan\webidl\URIError class
DOMException DOMException class

*2 “Error” simple exception type is obsoleted in W3C Editor’s draft (* this is not Error IDL type). Deprecated.

Requirement

Contribution

  1. Fork it ( https://github.com/esperecyan/webidl )
  2. Create your feature branch git checkout -b my-new-feature
  3. Commit your changes git commit -am 'Add some feature'
  4. Push to the branch git push origin my-new-feature
  5. Create new Pull Request

Or

Create new Issue

If you find any mistakes of English in the README or Doc comments or any flaws in tests, please report by such as above means. I also welcome translations of README too.

Acknowledgement

I use Web IDL (Second Edition) — Japanese translation as reference in creating this library.

HADAA helped me translate README to English.

Semantic Versioning

This library uses Semantic Versioning. The classes (including exceptions), interfaces, and methods not indicated “Internal” in the documentation of the library are the public API.

Licence

This library is licensed under the Mozilla Public License Version 2.0 (MPL-2.0).


All versions of webidl with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
symfony/polyfill-mbstring Version ^1.3.0
symfony/polyfill-php70 Version ^1.3.0
ext-spl Version *
ext-dom Version *
ext-pcre Version *
ext-date Version *
ext-reflection Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package esperecyan/webidl contains the following files

Loading the files please wait ....