https://github.com/cosmicjs/cosmicjs-php
The official PHP client for Cosmic JS. This module will help you easily add dynamic content to your website or application.
https://github.com/cosmicjs/cosmicjs-php
Last synced: 6 months ago
JSON representation
The official PHP client for Cosmic JS. This module will help you easily add dynamic content to your website or application.
- Host: GitHub
- URL: https://github.com/cosmicjs/cosmicjs-php
- Owner: cosmicjs
- Created: 2015-07-23T00:54:35.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-01-22T07:26:16.000Z (almost 10 years ago)
- Last Synced: 2025-04-05T05:11:32.413Z (9 months ago)
- Language: PHP
- Homepage: https://cosmicjs.com
- Size: 883 KB
- Stars: 7
- Watchers: 2
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://cosmicjs.com/)
===
### Getting started
Go to [https://cosmicjs.com](https://cosmicjs.com), create an account and setup a bucket.
### Install
```
git clone https://github.com/cosmicjs/cosmicjs-php
```
### Usage
```php
bucket_slug = "driver-example"; // bucket slug
$config->read_key = ""; // leave empty if not required
$config->write_key = ""; // leave empty if not required
include("cosmicjs.php");
/* Add
================================= */
$object_string = '{
"type_slug": "pages",
"title": "Test Title",
"content": "here is some test content",
"write_key": "' . $config->write_key . '"
}';
$object = $cosmicjs->addObject($object_string);
/* Edit
================================= */
$object_string = '{
"slug": "test-title",
"title": "New Title",
"content": "here is some NEW test content",
"write_key": "' . $config->write_key . '"
}';
$object = $cosmicjs->editObject($object_string);
/* Delete
================================= */
$object_string = '{
"slug": "test-title",
"write_key": "' . $config->write_key . '"
}';
$object = $cosmicjs->deleteObject($object_string);
/* Get Objects
================================= */
$objects = $cosmicjs->getObjects();
/* Get Media
================================= */
$media = $cosmicjs->getMedia();
?>
```