Download the PHP package garchicms/garchi-sdk-php without Composer
On this page you can find all versions of the php package garchicms/garchi-sdk-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download garchicms/garchi-sdk-php
More information about garchicms/garchi-sdk-php
Files in garchicms/garchi-sdk-php
Package garchi-sdk-php
Short Description A PHP SDK wrapper for the Garchi CMS API
License MIT
Informations about the package garchi-sdk-php
GarchiCMS PHP SDK
The GarchiCMS PHP SDK is a PHP package for interacting with the Garchi CMS API. It provides a simple, modular, and intuitive interface for managing categories, data items, reviews, reactions, spaces, and headless CMS features.
π API Documentation: Garchi CMS API Docs
π Table of Contents
- GarchiCMS PHP SDK
- π Table of Contents
- Features
- Installation
- Using Composer
- Usage
- Initializing the SDK
- Module Mapping
- Example Usages
- Data Item API
- Create a Data Item
- Update a published item
- Get All Items
- Category API
- Create a Category
- Get All Categories
- Review API
- Create a Review
- Reaction API
- Add or Update Reaction
- Space API
- Create a Space
- List Pages in a Space
- List Section Templates in a Space
- Compound Query API
- Perform a Compound Query
- Headless CMS API
- Get a Page
- Error Handling
- Types and Interfaces
- Contributing
- License
Features
- β Manage Data Items: Create, update, delete, and fetch data items.
- β Handle Categories: Create, update, delete, and list categories.
- β Manage Spaces: Create, update, and fetch spaces.
- β Handle Reviews: Create, update, delete, and fetch reviews.
- β Manage Reactions: Add or remove reactions for items or reviews.
- β Perform Compound Queries: Execute complex queries across items, categories, and reviews.
- β Work with Headless CMS: Manage assets, pages, and section templates.
Installation
Using Composer
Usage
This SDK is a wrapper around the Garchi CMS API, providing easy-to-use modular functions that map directly to API endpoints.
Initializing the SDK
Once installed, you can use the SDK without manually requiring files, thanks to Composer's autoloading.
Module Mapping
Each module corresponds to a specific API group:
-
$garchi->dataItemβ Data Item API$garchi->dataItem->create()corresponds to Create data item API$garchi->dataItem->update()corresponds to Update data item API$garchi->dataItem->updateWithStatus()is the same API, and also returnshas_draft$garchi->dataItem->delete()corresponds to Delete data item API$garchi->dataItem->createMetaInfo()corresponds to Create meta info for item API$garchi->dataItem->deleteMetaInfo()corresponds to Delete meta info for item API$garchi->dataItem->updateMetaInfo()corresponds to Update meta info for item API$garchi->dataItem->getBySpace()corresponds to Get items by space API$garchi->dataItem->semanticSearch()corresponds to Semantic item search API$garchi->dataItem->featured()corresponds to Get featured items API$garchi->dataItem->get()corresponds to Get data item API$garchi->dataItem->getAll()corresponds to Get all data items API$garchi->dataItem->filter()corresponds to Filter data items API$garchi->dataItem->filterByMeta()corresponds to Filter data items by meta information API$garchi->dataItem->getByIds()corresponds to Get data items by IDs API$garchi->dataItem->query()corresponds to Query items API$garchi->dataItem->getChildren()corresponds to List the items inside an item API
-
$garchi->categoryβ Category API$garchi->category->create()corresponds to Create category API$garchi->category->update()corresponds to Update category API$garchi->category->delete()corresponds to Delete category API$garchi->category->getAll()corresponds to Get all categories API
-
$garchi->spaceβ Space API$garchi->space->create()corresponds to Create a space API$garchi->space->update()corresponds to Update a space API$garchi->space->delete()corresponds to Delete a space API$garchi->space->getAll()corresponds to Get all spaces API$garchi->space->get()corresponds to Get space details API$garchi->space->categories()corresponds to Get categories for space API
-
$garchi->reviewβ Review API$garchi->review->create()corresponds to Create a review API$garchi->review->update()corresponds to Update review API$garchi->review->delete()corresponds to Delete review API$garchi->review->getByItem()corresponds to Get reviews for an item API
-
$garchi->headlessβ Headless API$garchi->headless->getAsset()corresponds to Get asset file for space API$garchi->headless->getPage()corresponds to Get page content API$garchi->headless->createOrUpdateSectionTemplates()corresponds to Create or update section templates API
-
$garchi->reactionβ Reaction API$garchi->reaction->manage()corresponds to Reaction API
$garchi->compoundQueryβ Compound Query API$garchi->compoundQuery->query()corresponds to Compound query API
Each moduleβs return values correspond to the return value of the respective API endpoint. The only difference is that for non-paginated API endpoints, each moduleβs return value can be accessed without the .data attribute.
Example Usages
Here are some example usages
Data Item API
Create a Data Item
Update a published item
Visitors keep seeing a published item while it changes: an update to it is kept as unpublished changes unless make_public is true. updateWithStatus() tells you which happened.
Metadata changes to a published item are kept with its unpublished changes too, and an entry added there has a negative meta_id until it is published.
Get All Items
Query items by their fields and metadata
Items inside items (variants, lessons)
A data item can sit inside another one, such as a variant inside its product or a lesson inside its course. Every item has parent_id and children_count; pass 'children' => 'include' to get the items inside as well.
Category API
Create a Category
Get All Categories
Review API
Create a Review
Reaction API
Add or Update Reaction
Space API
Create a Space
List Pages in a Space
List Section Templates in a Space
Compound Query API
Perform a Compound Query
Headless CMS API
Get a Page
Error Handling
All API calls throw exceptions if the API call fails.
Types and Interfaces
The SDK provides structured PHP classes for better type hinting and autocompletion.
Contributing
Feel free to submit issues and pull requests to improve the SDK.
License
This project is licensed under the MIT License.