PHPackages                             ap-lib/caster-scheme - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ap-lib/caster-scheme

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ap-lib/caster-scheme
====================

AP\\Caster\\Scheme is a plugins for caster for casting objects based on scheme

024PHP

Since Apr 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ap-lib/caster-scheme)[ Packagist](https://packagist.org/packages/ap-lib/caster-scheme)[ RSS](/packages/ap-lib-caster-scheme/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

AP\\Caster\\Scheme
==================

[](#apcasterscheme)

[![MIT License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

AP\\Caster\\Scheme is a plugins for [caster](https://github.com/ap-lib/caster) for casting objects based on [scheme](https://github.com/ap-lib/scheme)

Installation
------------

[](#installation)

```
composer require ap-lib/caster-scheme
```

Features
--------

[](#features)

- Caster uses the `ToObject::toObject(mixed $data)` method to construct objects.

Requirements
------------

[](#requirements)

- PHP 8.3 or higher

Getting started
---------------

[](#getting-started)

Here's a quick example demonstrating how to use `AP\Caster`.

### Initialize the PrimaryCaster with SchemeCaster

[](#initialize-the-primarycaster-with-schemecaster)

```
$toObject = new ToObject(
    new \AP\ToObject\ObjectParser\ByConstructor(),
    new PrimaryCaster([
        new SchemeCaster,
    ])
);

class Guid implements \AP\Scheme\ToObject
{
    public function __construct(public string $bites) {

    }

    public static function toObject(array|string|int|float|bool|null $data): static
    {
        if (is_string($data)) {
            return new static(pack("h*", str_replace('-', '', $data)));
        }
        throw ThrowableErrors::one('value is not valid uuid bytes');
    }
}

class Request {
    public function __constructor(
        public User $user,
        public Guid $guid,
    ){}
}

$obj = $toObject->makeObject(
    [
        "user" => [
            "name" => "John",
            "age" => 12
        ],
        "guid" => "6B29FC40-CA47-1067-B31D-00DD010662DA"
    ],
    Request::class
);
```

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1215fe5ecc9ba0ab1c730d3c992125cf6ebf460562e66be71ebae127789d465a?d=identicon)[AntonPanfilov](/maintainers/AntonPanfilov)

---

Top Contributors

[![anton-panfilov](https://avatars.githubusercontent.com/u/1083546?v=4)](https://github.com/anton-panfilov "anton-panfilov (8 commits)")

### Embed Badge

![Health badge](/badges/ap-lib-caster-scheme/health.svg)

```
[![Health](https://phpackages.com/badges/ap-lib-caster-scheme/health.svg)](https://phpackages.com/packages/ap-lib-caster-scheme)
```

###  Alternatives

[components/mathjs

Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with different data types like numbers, big numbers, complex numbers, fractions, units, and matrices.

15.0k3.8k](/packages/components-mathjs)[aura/payload-interface

An interface package for Domain Payload implementations.

13392.7k4](/packages/aura-payload-interface)[njxqlus/filament-lightbox

Lightbox entry for Filament

2054.6k](/packages/njxqlus-filament-lightbox)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
