PHPackages                             afosto/data - 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. [API Development](/categories/api)
4. /
5. afosto/data

ActivePackage[API Development](/categories/api)

afosto/data
===========

Afosto data models for the API

0.1.0(9y ago)01.4kApache-2.0PHP

Since Mar 10Pushed 9y agoCompare

[ Source](https://github.com/afosto/data)[ Packagist](https://packagist.org/packages/afosto/data)[ Docs](https://afosto.com)[ RSS](/packages/afosto-data/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (4)Versions (5)Used By (0)

Afosto Data
===========

[](#afosto-data)

Abstraction of the data models that are to be used to interact with our API. Currently this package has support for the following 'Operations':

- [Product](https://docs.afosto.com/#/product)

More operations are to be included soon. If you see a great usecase for this but need more information just contact us at .

\##Why

There already is an Api Client, why do I need this package? Well have concluded that the api client as it is right now it to tightly coupled with the API and interacting with it. This package is part of a bigger idea that we want to decouple parts that might be usefull for interaction with the API.

For instance you can already use the separated [oauth-client](https://github.com/afosto/oauth-client) to solve your problems in obtaining authentication for the API.

Getting Started
---------------

[](#getting-started)

Simply follow the installation instructions.

### Prerequisites

[](#prerequisites)

What things you need to install the software and how to install them

- PHP5.5+
- Composer (for installation)

### Installing

[](#installing)

Installing is easy through [Composer](http://www.getcomposer.org/).

```
composer require afosto/data

```

Examples
--------

[](#examples)

Now to build a product model:

```
$product = new Product();
```

Set the values inline:

```
$product->weight = 10;

$product->supplier = new Supplier();
$product->supplier->id = 1;
$product->supplier->name = 'TestSupplier';
```

Or use setAttributes to set data based on an input array

```
$item = new Item();
$item->setAttributes([
    'sku'    => 'TEST-SKU-234',
    'ean'    => '234554245',
    'prices' => [
        [
            'price_gross' => 23.54,
            'tax_class'   => [
                'id' => 2,
            ],
        ],
    ],
]);
$product->items[] = $item;
```

Optionally validate the newly generated model:

```
$product->validate();
```

Returns the structured data as an array:

```
$product->getAttributes();
```

Versioning
----------

[](#versioning)

We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/afosto/data/tags).

License
-------

[](#license)

This project is licensed under the Apache License 2.0 - see the [LICENSE.md](LICENSE.md) file for details

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~14 days

Total

4

Last Release

3315d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9396ebbc376698bfad31f77a42ee333fbc38b559f0ae79ad651ea5ebadbdb8de?d=identicon)[afosto](/maintainers/afosto)

---

Top Contributors

[![bakkerpeter](https://avatars.githubusercontent.com/u/23257320?v=4)](https://github.com/bakkerpeter "bakkerpeter (5 commits)")

---

Tags

dataafosto

### Embed Badge

![Health badge](/badges/afosto-data/health.svg)

```
[![Health](https://phpackages.com/badges/afosto-data/health.svg)](https://phpackages.com/packages/afosto-data)
```

###  Alternatives

[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[reliqarts/laravel-scavenger

The most integrated web scraper package for Laravel.

1571.5k](/packages/reliqarts-laravel-scavenger)[jeffreyhyer/alpaca-trade-api-php

PHP SDK for the Alpaca trade API

285.0k](/packages/jeffreyhyer-alpaca-trade-api-php)

PHPackages © 2026

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