Download the PHP package petrenkoanton/php-dto without Composer

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

php-dto

PHP Version Latest Version on Packagist Total Downloads License

PHP Composer Coverage Status type-coverage psalm-level Build Status

For developers | Related projects

Installation

Requirements

Composer

Functionality

Public methods

Dto

All getters are provided using the __call() magic method.

Method Exception
__construct(array $data) DtoException
__call(string $name, array $arguments): mixed DtoException
toArray(): array -

DtoCollection

Method Exception
__construct(Dto ...$items) DtoException
add(Collectable $item): void DtoException

Parent Collection

github.com/PetrenkoAnton/php-collection

Method Exception
filter(callable $callback): Collection -
getItems(): array -
getItem(int $key): Collectable CollectionException
first(): Collectable CollectionException
count(): int -

Exceptions

Main library exception is DtoException.

There are 3 groups of exceptions: InitDtoException, SetupDtoException and HandleDtoException

Code Message pattern Exception Group
101 Dto: %s | Property: %s | Err: Missed property type declaration NoTypeDeclarationException InitDtoException
102 Dto: %s | Property: %s | Err: Unsupported mixed property type declaration MixedDeclarationException InitDtoException
103 Dto: %s | Property: %s | Err: Unsupported object property type declaration ObjectDeclarationException InitDtoException
104 Dto: %s | Property: %s | Err: Class must implement DtoInterface NotDtoClassDeclarationException InitDtoException
105 Dto: %s | Property: %s | Err: No backing value for enum EnumNoBackingValueException InitDtoException
106 DtoCollection: %s | Err: Invalid constructor declaration DtoCollectionConstructorException InitDtoException
201 DtoCollection: %s | Expected Dto: %s | Given Dto: %s AddDtoException SetupDtoException
202 Dto: %s | Property: %s | Err: No data InputDataException SetupDtoException
203 Dto: %s | Property: %s | Expected type: %s | Given type: %s | Value: %s SetValueException SetupDtoException
204 Dto: %s | Property: %s | Enum: %s | Expected values: %s | Given type: %s | Value: %s SetValueEnumException SetupDtoException
301 Dto: %s | %s GetValueException HandleDtoException

Usage

Initialization

Important! Getter will be with the prefix is* if property is a bool type.

Simple DTO

Nested DTO (with Collection and Enum)

Return DTO as array

For developers

Requirements

Utils:

Setup

Initialize

Create ./docker/.env

Build container with the different php version

php 8.1

php 8.2

php 8.3

Also you need to run this command before build container with another php version. It will remove network and previously created container.

Other commands

Go inside of the container

Check php version

Check package version

Run tests and linters

Run PHPUnit tests with code coverage

Run Psalm

Run PHP_CodeSniffer

Or by all-in-one command from the inside of the container

License

The php-dto library is open-sourced software licensed under the MIT license.

Related projects


All versions of php-dto with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
petrenkoanton/php-collection Version ^1.0
petrenkoanton/key-normalizer Version ^2.0
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 petrenkoanton/php-dto contains the following files

Loading the files please wait ....