Download the PHP package xtompie/typed without Composer

On this page you can find all versions of the php package xtompie/typed. 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 typed

Typed

Primitives as Typed Objects. Library that maps pritmitve types into typed objects. Can be used to maps request/input into objects of defined classes. Gives ErrorCollection on fail.

Requiments

PHP >= 8.0

Installation

Using composer

Docs

Basic

Maping is done throught class constructor.

When the conditions are met then $pet will be an instance of PetPayload e.g.

Else $pet will be an instance of ErrorCollection e.g.

Advantages of use typed objects:

For maping objects Typed::object() have more precise type definition:

It is better for phpstan.

Class

ArrayOf

Source

Primitve field name can have characters that can't be used in method property name. To solve this Source can be used.

Only

To not allow undefined fields Only can be used.

Callback

Factory

By default objects are build through __constructor and their propertires. Alternative object can be build throught static factory method provided by Factory class attribute.

In above example the Factory attribute can be even: #[Factory]. If class is null then the context class is used. method parameter is be default typed. Method must be static. Must have one argument of type mixed. Must return the object or ErrorCollection.

Creating assert

Then add created assert attriute into property.

Others

Alnum, Alpha, ArrayKeyRegex, ArrayKeyString, ArrayLengthMax, ArrayLengthMin, ArrayValueLengthMax, ArrayValueLengthMin, ArrayValueString, Choice, Date, Digit, Email, LengthMax, LengthMin, Max, Min, NotBlank, Regex, Replace, ToBool, ToInt, ToString, Trim, TrimLeft, TrimRight,

Limitations

Object properties must have a specified type. The type cannot be a union or intersection. If incoming primitive data can have multiple types, use a mixed property. In such cases, you can us a To* assert or a Callback.


All versions of typed with dependencies

PHP Build Version
Package Version
Requires xtompie/result Version ^1.5
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 xtompie/typed contains the following files

Loading the files please wait ....