Download the PHP package andrew-gos/class-builder without Composer

On this page you can find all versions of the php package andrew-gos/class-builder. 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 class-builder

Class Builder Library

Version 1.2.3

Description

This library provides functionality to build objects from arrays or scalars.

The library allows the construction of interfaces, abstract classes, arrays of objects. It also supports the construction of object parameters whose type is an array with typed elements. There is the possibility to build variadic parameters from arrays. Additionally, you can build classes with a single required parameter from scalar values. Parameters can also be assembled where the type is an intersection or union of types.

The library gathers information about object parameters from the constructor's parameters.

Contacts

If you encounter a bug or have an idea, please write to [email protected] and type Telegram Library Bug or Telegram Library Idea in the email header.

Installation

To install the library, use Composer:

Simple example

To build an object, write:

Building abstract classes and interfaces

To build an interface or an abstract class, specify the available inheritors using the AvailableInheritors attribute. \ The first successfully built object will be returned. \ This attribute can take array of inheritors. \

Note, that if you make class parameter type as intersection of types, then this library will build inheritors, which contained in every interface or class in type

Data checkers for building

To control the building of interfaces or abstract classes, you can use the BuildIf attribute for the inheriting classes. \ This attribute instructs the builder to check the data before building. If the check fails, the builder will not construct the object. \ BuildIf attribute can take object of CheckerInterface attribute.

In this example, an object of class B will be built only if the data contains a field type equal to b.

Building typed arrays

To build typed arrays, use the ArrayType attribute. The attribute can take one type, an array of types, or an ArrayType object as a parameter.

Building objects from scalars

If an object has only one required parameter, the library allows building such objects from scalar values. Use the CanBeBuiltFromScalar attribute.

Get values from fields with custom names

If you want, you can redefine the field from which the value for the object property assembly is taken. \ To do it, use Field attribute.


All versions of class-builder with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
ext-ctype 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 andrew-gos/class-builder contains the following files

Loading the files please wait ....