PHPackages                             rachidlaasri/ycode-php-sdk - 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. rachidlaasri/ycode-php-sdk

ActiveLibrary[API Development](/categories/api)

rachidlaasri/ycode-php-sdk
==========================

PHP and Laravel SDK for working with ycode.

v0.1.0(5mo ago)191MITPHPPHP ^8.3.0CI passing

Since Dec 1Pushed 5mo agoCompare

[ Source](https://github.com/rashidlaasri/ycode-php-sdk)[ Packagist](https://packagist.org/packages/rachidlaasri/ycode-php-sdk)[ RSS](/packages/rachidlaasri-ycode-php-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (13)Versions (2)Used By (0)

[   ![Logo for ycode php sdk](art/header-light.png) ](https://x.com/rashidlaasri)YCODE PHP SDK
=============

[](#ycode-php-sdk)

 [![Build Status](https://github.com/rashidlaasri/ycode-php-sdk/actions/workflows/tests.yml/badge.svg)](https://github.com/rashidlaasri/ycode-php-sdk) [![Latest Stable Version](https://camo.githubusercontent.com/dbbb194856702cd3ddbf3a8336c4d8257d2d2865fd43a1e1305b14d784d31e5c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7261636869646c61617372692f79636f64652d7068702d73646b)](https://packagist.org/packages/rachidlaasri/ycode-php-sdk) [![License](https://camo.githubusercontent.com/9736ad4c417f084b4f9c59f2e4bfcc22943ff23ec63741f48272c7eb3d897f08/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7261636869646c61617372692f79636f64652d7068702d73646b)](https://packagist.org/packages/rachidlaasri/ycode-php-sdk)

This package provides **better API** for working with [YCODE](https://ycode.com) API.

> **Requires [PHP 8.3+](https://php.net/releases/)**

> **Note:** Please refer to the [official documentation](https://developers.ycode.com/docs/getting-started) for more details.

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

[](#installation)

⚡️ Get started by requiring the package using [Composer](https://getcomposer.org):

```
composer require rachidlaasri/ycode-php-sdk
```

Usage
-----

[](#usage)

This SDK is framework agnostic, meaning it can be used with any PHP project. But it also provides a fluent API for Laravel integration.

#### Vanilla PHP

[](#vanilla-php)

```
use RashidLaasri\YCODE\Config;
use RashidLaasri\YCODE\YCode;

$configs = new Config(
    baseUrl: 'https://app.ycode.com/api/v1',
    token: '',
);

$project = new YCode($configs);
```

### Laravel

[](#laravel)

If you are using Laravel, you may publish the configuration file with:

```
php artisan vendor:publish --tag=ycode-config
```

Then add these two keys to your .env file:

```
YCODE_BASE_URL=https://app.ycode.com/api/v1
YCODE_TOKEN=
```

and then you can resolve it from the IoC.

```
$project = app(Ycode::class);
```

Table of Contents
-----------------

[](#table-of-contents)

- [Collections](#-collections)
    - [List all collections](#list-all-collections)
    - [Get a single collection](#get-a-single-collections)
- [Sites](#sites)
    - [Publishes a site](#publishes-a-site)
- [Items](#-items)
    - [List all items](#list-all-items)
    - [Get a single item](#get-a-single-items)
    - [Create an item](#create-an-items)
    - [Update an item](#update-an-items)
    - [Patch an item](#patch-an-items)
    - [Delete an item](#delete-an-items)

### Collections

[](#collections)

#### List all collections

[](#list-all-collections)

```
$collections = $project->collections()->list();
```

Returns an array of `RashidLaasri\YCODE\DataObjects\Collection`

```
array:1 [
  0 => RashidLaasri\YCODE\DataObjects\Collection {
    +_ycode_id: "637781341a6f7"
    +name: "Blogposts"
    +singular_name: "Blogpost"
    +created_at: Carbon\Carbon @1668776244
    +fields: []
  }
]

```

For more details, please check the [official documentation.](https://developers.ycode.com/reference/list-collections)

#### Get single collection

[](#get-single-collection)

```
$collection = $project->collections()->get('637781341a6f7');
```

Returns an instance of `RashidLaasri\YCODE\DataObjects\Collection` with fields array

```
RashidLaasri\YCODE\DataObjects\Collection {
    +_ycode_id: "637781341a6f7"
    +name: "Blogposts"
    +singular_name: "Blogpost"
    +created_at: Carbon\Carbon @1668776244
    +fields: array:1 [
        0 => RashidLaasri\YCODE\DataObjects\Field{
          +id: 1
          +name: "ID"
          +type: "number"
          +default_value: null
        }
    ]
}
```

For more details, please check the [official documentation.](https://developers.ycode.com/reference/get-collection)

### Sites

[](#sites)

#### Publishes site

[](#publishes-site)

```
$sites = $project->sites()->publish();
```

Returns an array of `RashidLaasri\YCODE\DataObjects\Doamin`

```
array:1 [
  0 => RashidLaasri\YCODE\DataObjects\Doamin {
    +name: "example.ycode.site"
  }
]
```

For more details, please check the [official documentation.](https://developers.ycode.com/reference/publish-site)

### Items

[](#items)

#### List all items

[](#list-all-items)

```
$list = $project->items()->list('16687860798456377a79fce481', [
    'filters' => [
        'Name' => 'Blog',
    ],
]);
```

Returns a pagination instance

```
foreach($list->items() as $item)
{
    // $item is an instance of RashidLaasri\YCODE\DataObjects\Item
}
```

For more details, please check the [official documentation.](https://developers.ycode.com/reference/list-collections-items)

#### Get a single item

[](#get-a-single-item)

```
$item = $project->items()->get('16687860798456377a79fce481', 'abc123');
```

Returns an instance of `RashidLaasri\YCODE\DataObjects\Item`

```
RashidLaasri\YCODE\DataObjects\Item {
  +_ycode_id: "16687860798456377a79fce481"
  +id: 1
  +name: "Blogpost title"
  +slug: "blogpost-slug"
  +created_at: Carbon\Carbon @1668786123
  +updated_at: Carbon\Carbon @1668786123
  +created_by: "1669309481596637fa4299184e"
  +updated_by: "1669309527456637fa4576f6dc"
  +summary: "Lorem ipsum dolor sit amet, consectetur adipiscing elit..."
  +main_image: "https://storage.googleapis.com/D46OSM.jpg"
  +thumbnail: "https://storage.googleapis.com/ifJO0DZv.jpg"
  +featured: true
  +author: "16687859744696377a736727d8"
  +categories: array:2 [
    0 => RashidLaasri\YCODE\DataObjects\Category
      +name: "1669309639520637fa4c77eea7"
    }
    1 =>  RashidLaasri\YCODE\DataObjects\Category
      +name: "1669309662211637fa4de338d6"
    }
  ]
  +body: "Lorem ipsum dolor sit ams purus, semper nec tempor et, tincidunt sed justo...."
}
```

For more details, please check the [official documentation.](https://developers.ycode.com/reference/get-collection-item)

#### Create an item

[](#create-an-item)

```
$item = $project->items()->create('16687860798456377a79fce481', [
    // payload
]);
```

Returns an instance of `RashidLaasri\YCODE\DataObjects\Item`

```
RashidLaasri\YCODE\DataObjects\Item {
  +_ycode_id: "16687860798456377a79fce481"
  +id: 1
  +name: "Blogpost title"
  ...
}
```

For more details, please check the [official documentation.](https://developers.ycode.com/reference/get-collection-item)

#### Update an item

[](#update-an-item)

```
$item = $project->items()->update('16687868024636377aa7270ea9', 'abc123', [
    // payload
]);
```

Returns an instance of `RashidLaasri\YCODE\DataObjects\Item`

```
RashidLaasri\YCODE\DataObjects\Item {
  +_ycode_id: "16687860798456377a79fce481"
  +id: 1
  +name: "Blogpost title"
  ...
}
```

For more details, please check the [official documentation.](https://developers.ycode.com/reference/update-collection-item)

#### Patch an

[](#patch-an)

```
$item = $project->items()->patch('16687868024636377aa7270ea9', 'abc123', [
    // payload
]);
```

Returns an instance of `RashidLaasri\YCODE\DataObjects\Item`

```
RashidLaasri\YCODE\DataObjects\Item {
  +_ycode_id: "16687860798456377a79fce481"
  +id: 1
  +name: "Blogpost title"
  ...
}
```

For more details, please check the [official documentation.](https://developers.ycode.com/reference/patch-collection-item)

#### Delete an item

[](#delete-an-item)

```
$item = $project->items()->delete('16687868024636377aa7270ea9', 'abc123', [
    // payload
    '_draft' => true,
]);
```

Returns `JSON` response

```
{
  "deleted": 1
}
```

For more details, please check the [official documentation.](https://developers.ycode.com/reference/remove-collection-item)

Development
-----------

[](#development)

🧹 Keep a modern codebase with **Pint**:

```
composer lint
```

✅ Run refactors using **Rector**

```
composer refactor
```

⚗️ Run static analysis using **PHPStan**:

```
composer test:types
```

✅ Run unit tests using **PEST**

```
composer test:unit
```

🚀 Run the entire test suite:

```
composer test
```

License
-------

[](#license)

**YCODE PHP SDK** was created by **[Rachid Laasri](https://twitter.com/rashidlaasri)** under the **[MIT license](https://opensource.org/licenses/MIT)**.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance72

Regular maintenance activity

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

160d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/58811dbab9c7e082a81770e78c2912f60f6fc40f89acdacf65771d9e4a77e014?d=identicon)[rashidlaasri](/maintainers/rashidlaasri)

---

Top Contributors

[![rashidlaasri](https://avatars.githubusercontent.com/u/36804104?v=4)](https://github.com/rashidlaasri "rashidlaasri (23 commits)")

---

Tags

phplaravelycode

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/rachidlaasri-ycode-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/rachidlaasri-ycode-php-sdk/health.svg)](https://phpackages.com/packages/rachidlaasri-ycode-php-sdk)
```

###  Alternatives

[codebar-ag/laravel-docuware

DocuWare integration with Laravel

1221.1k](/packages/codebar-ag-laravel-docuware)[sandorian/moneybird-api-php

Moneybird API client for PHP

127.3k](/packages/sandorian-moneybird-api-php)[octw/aramex

A Library to integrate with Aramex APIs

2925.2k](/packages/octw-aramex)

PHPackages © 2026

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