weinc / weinc-php
WeInc AI website builder API client for PHP. Thin, zero-dependency wrapper for the WeInc v1 REST API.
Requires
- php: >=7.4
- ext-curl: *
- ext-json: *
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-15 02:11:07 UTC
README
WeInc AI website builder API client for PHP. Zero external dependencies (uses ext-curl and ext-json), PSR-4 autoloaded under the WeInc\ namespace.
WeInc (we.inc) is an AI website builder: describe an app in natural language and get a live, deployable React + Vite + Tailwind site. This package is a thin, honest client for the WeInc v1 REST API — it wraps the documented endpoints and adds nothing else.
- API docs: https://my.we.inc/docs/api
- OpenAPI spec: https://my.we.inc/api/v1/docs
- Website: https://we.inc
Install
composer require weinc/weinc-php
Requires PHP 7.4+ with curl and json extensions.
Quickstart
Get an API key (starts with wk_) from your WeInc agency dashboard.
use WeInc\WeIncClient; $weinc = new WeIncClient(getenv('WEINC_API_KEY')); // 1. List your projects $result = $weinc->listProjects(['limit' => 10]); echo $result['total']; // 2. Fetch one project $project = $weinc->getProject($result['projects'][0]['id'])['project']; // 3. Create a project for a client $created = $weinc->createProject([ 'client_email' => 'client@example.com', 'name' => 'New Site', ]); // 4. Where is it live? $preview = $weinc->getPreviewUrls($project['id']); echo $preview['published_url']; // null if never published // 5. Clients, templates, plans, analytics $clients = $weinc->listClients(); $templates = $weinc->listTemplates(); $plans = $weinc->listPlans(); $analytics = $weinc->getAnalytics(['days' => 30]);
API
All methods return decoded JSON arrays and throw WeInc\WeIncError on any failure (with ->status and ->body when the server responded).
| Method | Endpoint |
|---|---|
listProjects($params) |
GET /projects (limit, offset, client_id, status) |
getProject($projectId) |
GET /projects/{id} |
createProject($data) |
POST /projects (client_email, name required) |
updateProject($projectId, $data) |
PATCH /projects/{id} |
deleteProject($projectId) |
DELETE /projects/{id} |
getPreviewUrls($projectId) |
GET /projects/{id}/preview |
listClients() |
GET /clients |
createClient($data) |
POST /clients (email required) |
getClient($clientId) |
GET /clients/{id} |
updateClient($clientId, $data) |
PATCH /clients/{id} |
listTemplates() |
GET /templates |
listPlans() |
GET /plans |
getAnalytics($params) |
GET /analytics (days, project_id) |
An escape hatch is included for endpoints this client does not wrap:
$webhooks = $weinc->request('GET', '/webhooks');
Notes on accuracy
- All wrapped endpoints match the published OpenAPI spec at https://my.we.inc/api/v1/docs, except
getPreviewUrls, which is implemented by the API but not yet listed in the OpenAPI document; its shape was verified against the WeInc server source on 2026-08-04. If the spec later documents it differently, the spec wins. - Authentication:
Authorization: Bearer wk_...org API key.
Testing
php tests/smoke.php
The smoke test uses a mocked transport — no live API calls are made.
License
MIT