Php
A collection of skills for AI coding agents. SDK setup and integration guidance for headless WooCommerce development.
npx -y skills add cocart-headless/cocart-skills --skill phpAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
CoCart PHP SDK patterns for headless WooCommerce. Use when setting up CoCart in PHP projects using Laravel, Symfony, WordPress plugins, or plain PHP.
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
3.6 KB, 722 tokens by cl100k_base, as published. Nobody here has run it
CoCart PHP SDK Skill
You are an expert in the CoCart PHP SDK (cocart-headless/cocart-php). When a user adds "use CoCart" to a prompt and their project is PHP-based, apply this skill.
Note: The PHP SDK is still in development and not yet production-ready. Mention this when relevant and encourage users to report bugs.
Installation
# Install the SDK
composer require cocart/sdk
# Recommended: Guzzle for best performance
composer require guzzlehttp/guzzle
Requirements: PHP 8.2+. One of: Guzzle (recommended), cURL, or PHP Streams for HTTP.
Quick Start
<?php
require 'vendor/autoload.php';
use CoCart\SDK\CoCart;
// Guest customer — cart key is persisted to PHP session automatically
$client = new CoCart('https://your-store.com');
// Browse products
$products = $client->products()->all();
// Add item to cart
$client->cart()->addItem(123, 2);
// Get cart
$cart = $client->cart()->get();
Configuration
$client = new CoCart('https://your-store.com', [
'cart_key' => 'existing_cart_key',
'username' => '[email protected]',
'password' => 'password',
'jwt_token' => 'your-jwt-token',
'consumer_key' => 'ck_xxxxx',
'consumer_secret' => 'cs_xxxxx',
'timeout' => 30,
'verify_ssl' => true,
'rest_prefix' => 'wp-json',
'namespace' => 'cocart',
'main_plugin' => 'basic',
'etag' => true,
'auto_storage' => true,
'session_key' => 'cocart_cart_key',
]);
Common Mistakes
- Not installing an HTTP adapter — The SDK needs Guzzle, cURL, or PHP Streams. Install Guzzle for best results:
composer require guzzlehttp/guzzle. - Forgetting
session_start()— Cart key auto-persistence uses$_SESSION. Ensuresession_start()is called before SDK usage in plain PHP. - Exposing consumer keys in client-side code — Consumer keys are server-side only. Never output them in HTML or JavaScript.
- Using
'main_plugin' => 'legacy'on new installs — Only uselegacyfor WooCommerce Cart REST API v4.x. New CoCart installs usebasic(default).
When to Load References
- Configuring authentication (guest, Basic Auth, consumer keys, JWT) → references/authentication.md
- Working with cart operations (add, update, remove, coupons, batch) → references/cart.md
- Querying products (list, search, filter, single product) → references/products.md
WordPress / WooCommerce Requirements
- WooCommerce installed and active
- CoCart plugin installed (free tier available)
- CoCart Plus for advanced features
- Optional: CoCart JWT Authentication for JWT auth
What ships with it: 3 files
3.9 KB alongside SKILL.md
references/
- authentication.md880 B
- cart.md2.7 KB
- products.md378 B