Download the PHP package zolta/forge without Composer

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

Zolta Forge

The missing domain layer for PHP.

Stop scattering validation across controllers, form requests, and service classes. Forge gives you true Domain-Driven Design primitives — Value Objects, Entities, Aggregates, Rules, Specifications, Policies, Invariants, and Transformers — all driven by PHP 8 attributes, all enforced at construction time, all framework-agnostic.


Why Forge?

The problem

PHP's ecosystem has excellent tools for persistence (Eloquent, Doctrine) and HTTP (Laravel, Symfony), but the domain layer — the part that enforces your business rules — is left as a DIY exercise. The result: validation logic scattered across controllers, form requests, middleware, and service classes. Rules are duplicated. Invariants are violated. Bugs hide in the gaps.

What Forge does differently

Approach How it works Trade-off
Manual VOs Hand-written constructors with inline validation No reuse, no composition, no discovery
Spatie Laravel Data Data transfer objects with casting Persistence-layer focused, no domain rules/specs/invariants
Doctrine Embeddables ORM-coupled value types Tied to Doctrine lifecycle, no standalone resolution
Zolta Forge Attribute-driven pipeline: Transform → Validate → Specify → Construct → Enforce Zero inheritance tax, composable, framework-agnostic

Forge treats Value Object construction as a pipeline, not a constructor:

  1. #[Transform] — Normalize raw input (trim, lowercase, parse dates)
  2. #[UseRule] — Guard property constraints (non-empty, max length, regex, password strength)
  3. #[UseSpecification] — Evaluate business logic (email format, allowed domain, minimum age)
  4. Nested VO resolution — Recursively construct child Value Objects from raw arrays
  5. #[UseInvariant] — Enforce class-level structural guarantees post-construction
  6. #[UsePolicy] — Apply post-construction behavior (token generation, hash verification)

Every stage is declarative (PHP 8 attributes), composable (.and(), .or(), .not()), and cacheable (sub-millisecond on warm calls).

Who is this for?

Installation

Laravel adapter discovery is automatic through Composer metadata.


What's in the box

Value Objects with auto-resolution

The centerpiece. Declare properties with attributes — Forge handles the rest:

Nested VOs resolve recursively — a UserCredential containing an Email and Password resolves the entire tree from a flat array:

8 built-in rules

NonEmptyRule · MaxLengthRule · RegexRule · UuidRule · PasswordRule · PasswordPolicyRule · PermissionNameRule · PositiveNumberRule

All composable: $rule->and(new MaxLengthRule(255))->or(new FallbackRule()).

5 built-in specifications

EmailFormatSpecification · AllowedDomainSpecification · UuidSpecification · MinAgeSpecification + abstract base for your own.

Compose with logical operators: $spec->and($other), $spec->or($fallback), $spec->not().

3 built-in transformers

EmailNormalizer · DateTimeNormalizer · IdentifierNormalizer — pipe them: $t->and(new OtherTransformer()).

Invariants & Policies

Invariants enforce class-level structural guarantees after construction:

Policies apply post-construction behavior — token generation, hash verification, expiry checks:

Built-in: EmailVOInvariant · RoleNameInvariant · VerifiedAtInvariant · CreditInvariant · PasswordPolicy · EmailPolicy · AccessTokenPolicy.

Entities & Aggregates

Event-recording domain objects with immutability protection:

Framework-agnostic adapter system

Forge auto-discovers framework adapters from Composer metadata — no manual registration, no framework coupling:

Consumer packages (zolta/cqrs, zolta/http) use this same mechanism to stay decoupled.


Performance

Benchmarked on a real application (Laravel 12, PHP 8.3, SQLite):

Operation Cold (first call) Warm (cached)
Single VO hydration 2–5ms < 0.6ms
Complex command (3 nested VOs) 9ms < 1ms
Reflection metadata resolution 4ms cached — 0ms

Forge caches ReflectionClass instances, property metadata, attribute data, and type resolution maps per class. After the first construction, subsequent VO creation is effectively free.


25+ built-in Value Objects

Production-ready domain types for common use cases:

Identity: UserId · RoleId · PermissionId · OAuthAccountId · AbstractUuid
Auth: Email · Password · AccessToken · RefreshToken · VerificationCode · UserCredential
OAuth: OAuthProvider (Google, Microsoft, GitHub) · OAuthProviderId
Profile: Username · RoleName · PermissionName · AvatarUrl
Domain: Credit · Description · Pagination · Terms

Tests

Monorepo runner:

50 tests, 71 assertions covering VO resolution, rule composition, specification logic, invariant enforcement, entity events, and adapter discovery.


Collaboration

  1. Keep Forge focused on domain concerns only.
  2. Put integration/runtime concerns in adapters or consumer packages.
  3. Run composer run qa before opening a PR.

Part of the Zolta Ecosystem

Forge is the foundation layer — consumed by the application and transport layers:

Package Layer Link
zolta/forge Domain You are here
zolta/cqrs Application packages/cqrs
zolta/http Transport packages/http

Documentation

Full documentation is available in the docs/ directory.

License

MIT © 2026 Redouane Taleb


All versions of forge with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
psr/container Version ^2.0
symfony/process Version ^7.3
symfony/serializer Version ^7.3
symfony/property-access Version ^7.3
symfony/property-info Version ^7.3
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 zolta/forge contains the following files

Loading the files please wait ...