Download the PHP package dealnews/datocms-cma-client without Composer
On this page you can find all versions of the php package dealnews/datocms-cma-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dealnews/datocms-cma-client
More information about dealnews/datocms-cma-client
Files in dealnews/datocms-cma-client
Package datocms-cma-client
Short Description Unofficial DatoCMS API Client for the Content Management API
License BSD-3-Clause
Informations about the package datocms-cma-client
datocms-cma-client
Unofficial DatoCMS API Client for the Content Management API
Usage
Initialize the client:
Records/Items
Get a list of records/items
Get a filtered list of records/items
Creating and Updating Records
You can create/update records in three ways:
Option 1: Using the Record Input Class with DataTypes
This approach provides type safety and validation, but it is incomplete. Structured-Text is the big missing piece.
Option 2: Using the Record Input Class with Plain Arrays
You can use the Record class but populate attributes with arrays:
Option 3: Using a Plain Array
You can still pass a plain array directly:
Available DataTypes Classes
The library provides the following DataTypes classes for structured field values:
Scalar- For simple string, integer, float, or boolean valuesColor- For RGBA color values (red, green, blue, alpha: 0-255)Location- For geographic coordinates (latitude: -90 to 90, longitude: -180 to 180)Asset- For file uploads with metadata (upload_id, title, alt, focal_point, custom_data)ExternalVideo- For external video embeds (YouTube, Vimeo, Facebook)SEO- For SEO metadata (title, description, image, twitter_card, no_index)
All DataTypes support localization via the addLocale() method for multilingual content.
Models (Item-Types)
Models define the content types in your DatoCMS project. The DatoCMS API refers to these as "item-types".
Get a list of models:
Get a specific model by ID:
Create a new model:
Update a model:
Delete a model:
Duplicate a model:
Model Attributes
Common model attributes include:
| Attribute | Type | Description |
|---|---|---|
name |
string | Human-readable name |
api_key |
string | Machine-friendly key |
singleton |
bool | Single-instance model |
sortable |
bool | Allow manual record sorting |
modular_block |
bool | Is a block model |
tree |
bool | Hierarchical records |
draft_mode_active |
bool | Enable drafts |
all_locales_required |
bool | Require all locales |
ordering_direction |
string | asc or desc |
collection_appearance |
string | compact or table |
hint |
string | Editor hint text |
Uploads
The library provides a complete Upload API for managing media assets in DatoCMS.
Upload a File
The simplest way to upload a file is with the uploadFile() helper method:
Upload from URL
Upload a file directly from a remote URL:
List and Filter Uploads
Upload Collections (Folders)
Organize uploads into folders:
Upload Tags
Manage user-defined tags for uploads:
Smart Tags
List auto-detected smart tags (read-only):
Bulk Operations
Manual Upload Flow
For advanced use cases, you can use the low-level upload flow:
All versions of datocms-cma-client with dependencies
guzzlehttp/guzzle Version ^7.10
moonspot/value-objects Version ^2.3
psr/log Version ^3.0