PHPackages                             token27/nexus-ai-content - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. token27/nexus-ai-content

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

token27/nexus-ai-content
========================

Generic content orchestration layer for NexusAI workflows, prompts, tracking, pricing, and domain extensions.

v1.0.0(2mo ago)00MITPHP ^8.3

Since May 22Compare

[ Source](https://github.com/token27/nexus-ai-content)[ Packagist](https://packagist.org/packages/token27/nexus-ai-content)[ Docs](https://github.com/token27/nexus-ai-content)[ RSS](/packages/token27-nexus-ai-content/feed)WikiDiscussions Synced 3w ago

READMEChangelog (1)Dependencies (12)Versions (2)Used By (0)

nexus-ai-content
================

[](#nexus-ai-content)

[![CI](https://github.com/token27/nexus-ai-content/actions/workflows/ci.yml/badge.svg)](https://github.com/token27/nexus-ai-content/actions)[![PHPStan Level 8](https://camo.githubusercontent.com/412205ac46adf8d1c9329cfcacca7da2697c664b7f1ffd18076a4a17c1e9de6d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c253230382d316636666562)](https://phpstan.org/)[![Latest Version](https://camo.githubusercontent.com/a0e3dabe1cc8a134b3d7d64007a4311c542091258c62fab8360afbbafea80d69/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f6b656e32372f6e657875732d61692d636f6e74656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/token27/nexus-ai-content)[![PHP 8.3+](https://camo.githubusercontent.com/38027453aeb7eb818641c9de8f82b7624c3558d92634f1946edc715c3ddf8956/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332532422d3737374242343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://php.net)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](LICENSE)[![Tests](https://camo.githubusercontent.com/5825334f8d883bf366a0fcd8a76c5738cfcdf088a4675b2eb4b550218336f7c2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54657374732d3525323070617373696e672d627269676874677265656e)](docs/testing.md)

A **framework-agnostic, workflow-first** PHP 8.3+ content orchestration layer for the NexusAI ecosystem. Compose versioned prompts, AI drivers, resumable workflows, tracking, pricing, and domain extensions behind one fluent API.

Why nexus-ai-content?
---------------------

[](#why-nexus-ai-content)

Article generation, social posts, newsletters, scripts, product descriptions, and future content types all need the same foundation:

- choose a content type and workflow
- resolve versioned prompts from `nexus-ai-prompts`
- execute nodes through `nexus-ai-workflows`
- call providers through `nexus-ai`
- track every run through `nexus-ai-tracking`
- calculate cost and enforce budgets through `nexus-ai-pricing`
- keep domain packages focused on their domain instead of infrastructure

`nexus-ai-content` is that shared layer. It is intentionally **not** an article generator. Article logic belongs in `nexus-ai-content-articles`.

Features
--------

[](#features)

- **Engine + Builder + Registry pattern** consistent with the NexusAI libraries.
- **Fluent content API** for provider/model selection, workflow selection, variables, language, run id, tracking, pricing, and budgets.
- **Workflow registry** keyed by `contentType/workflowName`.
- **Prompt-aware AI node** with `ContentAINode`.
- **Tracking-ready execution** with run id, prompt id, prompt version, content type, workflow, provider, model, tokens, cost, and latency.
- **Pricing-ready execution** with post-request cost calculation and optional pre-request budget checks.
- **Extension bootstrap** so packages like `nexus-ai-content-articles` can register workflows cleanly.
- **Test-friendly driver injection** through `withDriver()`.

Installation
------------

[](#installation)

```
composer require token27/nexus-ai-content
```

**Requires:** PHP 8.3+ and the core NexusAI packages listed in `composer.json`.

Quick Start
-----------

[](#quick-start)

```
use Token27\NexusAI\Content\ContentEngine;
use Token27\NexusAI\Content\Node\ContentAINode;
use Token27\NexusAI\Workflows\Engine\WorkflowBuilder;

$workflow = WorkflowBuilder::named('default')
    ->addNode('draft', new ContentAINode(
        promptIdentifier: 'content/draft',
        outputKey: 'content',
        promptVersion: '1.0.0',
    ))
    ->build();

$engine = ContentEngine::create()
    ->withPromptRegistry($promptRegistry)
    ->withTracking($tracking)
    ->withPricing($pricing);

$engine->getRegistry()->register('article', $workflow);

$result = $engine
    ->for('openai', 'gpt-4o-mini')
    ->withContentType('article')
    ->withLanguage('es')
    ->withVariable('topic', 'Calidad de contenido con IA')
    ->withBudget(0.25)
    ->generate();

echo $result->text;
```

For tests, inject a pre-built driver:

```
$result = $engine
    ->for('fake', 'test-model')
    ->withContentType('article')
    ->withDriver($fakeDriver)
    ->generate();
```

Documentation
-------------

[](#documentation)

GuideDescription[Documentation Home](docs/README.md)Full documentation map[Installation](docs/installation.md)Composer, dependencies, and first setup[Quick Start](docs/quick-start.md)First workflow with a fake driver[Fluent API](docs/fluent-api.md)Engine and builder methods[Workflows](docs/workflows.md)Registering and running content workflows[Prompts](docs/prompts.md)Using `nexus-ai-prompts` with `ContentAINode`[Tracking and Pricing](docs/tracking-pricing.md)Telemetry, costs, budgets, and tokenizer notes[Extending](docs/extending.md)Creating domain extensions[Testing](docs/testing.md)Testing content workflows and nodes[Contributing](docs/contributing.md)Development setup and collaboration rules[Architecture](docs/ARCHITECTURE_DECISION.md)Why this package exists before article domains[Troubleshooting](docs/troubleshooting.md)Common failures and fixesExamples
--------

[](#examples)

The `examples/` directory contains runnable production-style examples that read `.env`, configure real providers through `NexusAI`, load prompts, enable pricing, and optionally write tracking events:

- [00-openai-draft.php](examples/00-openai-draft.php)
- [01-anthropic-outline.php](examples/01-anthropic-outline.php)
- [02-gemini-spanish.php](examples/02-gemini-spanish.php)
- [03-deepseek-budget.php](examples/03-deepseek-budget.php)
- [04-tracking-jsonfile.php](examples/04-tracking-jsonfile.php)
- [05-custom-openai-compatible.php](examples/05-custom-openai-compatible.php)
- [06-testing-fake-driver.php](examples/06-testing-fake-driver.php)
- [07-openai-raw-prompt.php](examples/07-openai-raw-prompt.php)

Quality Gates
-------------

[](#quality-gates)

```
composer validate --strict
vendor/bin/php-cs-fixer fix --dry-run --diff
vendor/bin/phpstan analyse --level=8 src tests
vendor/bin/phpunit
```

License
-------

[](#license)

MIT. See [LICENSE](LICENSE).

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance87

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

64d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/78189912?v=4)[Token27](/maintainers/token27)[@token27](https://github.com/token27)

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/token27-nexus-ai-content/health.svg)

```
[![Health](https://phpackages.com/badges/token27-nexus-ai-content/health.svg)](https://phpackages.com/packages/token27-nexus-ai-content)
```

###  Alternatives

[sameer-shelavale/php-countries-array

PHP class to get array of countries names with ISO\_3166-1 alpha-2, alpha-3, numeric codes, ISD codes and continent

34429.7k1](/packages/sameer-shelavale-php-countries-array)[smic/dynamic-routing-pages

Generates "limitToPages" configuration for your enhancers on the fly so you don't need to hardcode it.

21127.1k](/packages/smic-dynamic-routing-pages)[laravel-frontend-presets/zurb-foundation

Laravel 6.0+ front-end preset for Zurb Foundation

5418.7k](/packages/laravel-frontend-presets-zurb-foundation)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
