Download the PHP package cline/struct without Composer

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

GitHub Workflow Status Latest Version on Packagist Total Downloads


struct

Lean, attribute-driven Laravel data objects for applications that want the useful parts of spatie/laravel-data without the magic-heavy surface area.

Requirements

Requires PHP 8.4+

Installation

Optional features:

Install cline/math when you want first-class arbitrary-precision BigNumber, BigInteger, BigDecimal, or BigRational DTO properties.

Install cline/money when you want first-class Money, RationalMoney, or MoneyBag DTO properties, or the #[AsMoney(...)] attribute for scalar currency amounts.

Install cline/numerus when you want first-class Numerus DTO properties or numeric normalization attributes such as #[Round], #[Clamp], and #[Abs].

Install cline/phone-number when you want first-class PhoneNumber DTO properties, including scalar local-number hydration with #[AsPhoneNumber(regionCode: ...)].

Install cline/postal-code when you want first-class PostalCode DTO properties, including scalar postal-code hydration with #[AsPostalCode(country: ...)].

Install cline/semver when you want first-class Version and Constraint DTO properties for semantic version payloads.

Struct also ships built-in deterministic string transformation attributes such as #[Trim], #[SnakeCase], #[Slug], #[Limit], #[Replace], and extraction attributes like #[After], #[Before], and #[Between]. It also ships missing-value generators such as #[Uuid], #[Ulid], #[Random], and #[Password] for DTO fields that should be created only when the input key is absent. Install ramsey/uuid if you want to use #[Uuid(...)]. String transforms and generators now live under Cline\Struct\Attributes\Strings, while compatibility aliases remain available at Cline\Struct\Attributes. Collection transforms now live under Cline\Struct\Attributes\Collections, including helpers such as #[Collections\\Reverse], #[Collections\\Unique], #[Collections\\Slice], and #[Collections\\OnlyKeys]. Struct also ships first-class detached Illuminate\\Support\\Collection property support through #[AsCollection(...)], separate from DataList and DataCollection, including callback-based collection attributes such as #[Collections\\Filter(...)], #[Collections\\Map(...)], #[Collections\\GroupBy(...)], #[Collections\\UniqueBy(...)], and #[Collections\\MapInto(...)]. Collection-returning transforms also include attributes such as #[Collections\\Where(...)], #[Collections\\Pluck(...)], #[Collections\\Flatten(...)], #[Collections\\ChunkWhile(...)], #[Collections\\MapToGroups(...)], #[Collections\\CountBy(...)], #[Collections\\Diff(...)], #[Collections\\Merge(...)], #[Collections\\Pipe(...)], #[Collections\\Tap(...)], and conditional wrappers like #[Collections\\When(...)]. Derived collection results and generated collection sources live under Cline\\Struct\\Attributes\\CollectionResults and Cline\\Struct\\Attributes\\CollectionSources, for methods such as #[Contains('posts', ...)], #[After('posts', ...)], #[ToJson('posts')], #[Reduce('totals', ...)], #[Wrap(source: 'name')], and #[FromJson(source: 'payload')]. For deferred traversal, Struct also ships LazyDataList and LazyDataCollection with explicit #[AsLazyDataList(...)] and #[AsLazyDataCollection(...)] attributes. These lazy wrappers keep Struct-owned collection semantics and typed item hydration, but they are transport-focused and intentionally reject Attributes\\Collections\\* transforms in v1. Struct also now supports detached Illuminate\\Support\\LazyCollection DTO properties through #[AsLazyCollection(...)], with a strict-lazy transform subset such as #[Collections\\Map(...)], #[Collections\\Filter(...)], #[Collections\\Skip(...)], and #[Collections\\Take(...)]. Derived CollectionResults may read from lazy sources, but eager-only collection transforms are rejected on LazyCollection properties.

Context-Aware Hydration

Hydration hooks can opt into whole-DTO context when a cast or attribute needs to inspect the raw payload or sibling values that have already been resolved.

PropertyHydrationContext exposes the DTO class, current property, raw input, and the sibling properties resolved so far. The context is passed as an immutable argument during hydration; Struct does not mutate shared cast instances with request-scoped data.

Documentation

Change log

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please use the GitHub security reporting form rather than the issue queue.

Credits

License

The MIT License. Please see License File for more information.


All versions of struct with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5.0
cline/attribute-reader Version ^1.0
facade/ignition-contracts Version ^1.0.2
laravel/framework Version ^10.0 || ^11.0 || ^12.0 || ^13.0
spatie/laravel-package-tools Version ^1.93.0
spatie/php-structure-discoverer Version ^2.4
symfony/yaml Version ^7.4.6 || ^8.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 cline/struct contains the following files

Loading the files please wait ...