PHPackages                             samsoncms/api - 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. samsoncms/api

ActiveLibrary[API Development](/categories/api)

samsoncms/api
=============

SamsonCMS API module

0.0.10(9y ago)02.5k75Open Software License (OSL) v 3.0PHP

Since Feb 11Pushed 9y ago3 watchersCompare

[ Source](https://github.com/samsoncms/api)[ Packagist](https://packagist.org/packages/samsoncms/api)[ Docs](http://samsonos.com/)[ RSS](/packages/samsoncms-api/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (5)Versions (16)Used By (5)

\#SamsonCMS API module

[![Latest Stable Version](https://camo.githubusercontent.com/044a280e2bd45eb6176b6c6569724bfae8080042c35ade183587c65d6bbed50b/68747470733a2f2f706f7365722e707567782e6f72672f73616d736f6e636d732f6170692f762f737461626c652e737667)](https://packagist.org/packages/samsoncms/material)[![Build Status](https://camo.githubusercontent.com/f2e86a1b1988f69bac6848ef5a932a1bfa1bacd2fabf01a06630ba9e7fe007f1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73616d736f6e636d732f6170692f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/samsoncms/api/build-status/master)[![Code Coverage](https://camo.githubusercontent.com/e7e686e4f91441fe4280687f0a1da0b0f934cce16766bd829ea4606a6a21ad15/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73616d736f6e636d732f6170692f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/samsoncms/api/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/e82f6475005714932a1c6380e0732251e092f6903e28f9af7755ee9fdb506ef3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73616d736f6e636d732f6170692f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/samsoncms/api/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/b465fddc40564d328672a54ef78b58292d6709149c79908099196459de423977/68747470733a2f2f706f7365722e707567782e6f72672f73616d736f6e636d732f6170692f646f776e6c6f6164732e737667)](https://packagist.org/packages/samsoncms/material)[![Stories in Ready](https://camo.githubusercontent.com/2c7ee1c2b191269a95ae4d3323e16a19d4fed725d892ae719077367dd3ca9eea/68747470733a2f2f62616467652e776166666c652e696f2f73616d736f6e636d732f6d6174657269616c2e706e673f6c6162656c3d7265616479267469746c653d5265616479)](https://waffle.io/samsoncms/material)

> SamsonCMS API for interaction with materials, fields and structures.

\##Additional fields table After creating corresponding Table structure and setting its Additional fields you can get additional fields table object(`\samsoncms\api\field\Table`) ancestor for a specific `\samsoncms\api\Material` ancestor you need to create class that extends generated additional fields table:

```
class MyTable extends \samsoncms\api\MyGeneratedTable
{
    protected $indexView = 'specify a path to index view file';
    protected $rowView = 'specify a path to row view file';
}

// Creating an instance, with QueryInterface, ViewInterface and Entity identifier
$table = new MyTable($query, $this, $material->MaterialID)
```

This class will contain generated generic methods for retrieving collection of table column values with according field name, for example if you have additional field with name `age` method `age()` would be generated to get collection of `age`values in all table rows.

\###Rendering custom additional field tables SamsonCMS will generate all created Table structure automatically to simplify your code creation, the only thing that needs to be done is extending this generated classes and creating a views for outputting.

> Remember `\samsoncms\api\field\Table` is dependent on `\samsonframework\core\ViewInterface` instance and uses it for rendering its views, so the path to views and views themselves should be located within this instance.

\###Default index view file By default index view renders all rendered rows into view variable with name stored in `\samsoncms\api\field\Table::ROWS_VIEW_VAR` - `rows`:

```

    Table title

```

\###Default row view file By default `\samsoncms\api\field\Row` ancestor view object is stored in `\samsoncms\api\field\Table::ROW_VIEW_VAR` - `row`:

```

```

> Give a type hint to a generated `\samsoncms\api\field\Row` ancestor and IDE will help outputting needed row data.

\#Navigation

\#Material

Added method for creating/updating material additional fields `public function setFieldByID($fieldID, $value, $locale = DEFAULT_LOCALE)`Method find Field record in database by Field identifier and the receives its type for correct storing of additional field value.

\#Field You can find additional field `samsonframework\orm\RecordInterface` object by using one of provided methods:

- By its identifier `\samsoncms\api\Field::byID($query, $identifier, &$return = null)`
- By its name `\samsoncms\api\Field::byName($query, $name, &$return = null)`
- By its name or identifier `\samsoncms\api\Field::byNameOrID($query, $identifier, &$return = null)`

All this methods requires first argument `samsonframework\orm\QueryInterface` instance for performing database queries.

Regular usage example:

```
/** @var \samsoncms\api\Field $fieldRecord Try to find additional field record */
$fieldRecord = \samsoncms\api\Field::byNameOrID('image')
if (isset($fieldRecord)) {
    // Additional field has been found
}
```

Last argument is optional and should be used for simple and beautiful condition creation:

```
/** @var \samsoncms\api\Field $fieldRecord Try to find additional field record */
if (\samsoncms\api\Field::byNameOrID('image', $fieldRecord)) {
    // Additional field has been found
}
```

\#Field value

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 84.1% 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 ~24 days

Recently: every ~44 days

Total

10

Last Release

3377d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0be8756efdc8f599b8fe9261bed31570d0f140a3b921f0f891877a9133ad654c?d=identicon)[samsonos](/maintainers/samsonos)

---

Top Contributors

[![vitalyiegorov](https://avatars.githubusercontent.com/u/586558?v=4)](https://github.com/vitalyiegorov "vitalyiegorov (391 commits)")[![rmolodyko](https://avatars.githubusercontent.com/u/4399482?v=4)](https://github.com/rmolodyko "rmolodyko (26 commits)")[![nik-os](https://avatars.githubusercontent.com/u/7326967?v=4)](https://github.com/nik-os "nik-os (19 commits)")[![getmanenko](https://avatars.githubusercontent.com/u/14871360?v=4)](https://github.com/getmanenko "getmanenko (14 commits)")[![expenect](https://avatars.githubusercontent.com/u/10962934?v=4)](https://github.com/expenect "expenect (13 commits)")[![onysko](https://avatars.githubusercontent.com/u/7703953?v=4)](https://github.com/onysko "onysko (1 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/samsoncms-api/health.svg)

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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