Search by

websonette / web-application

kleinpeter

Framework-independent page context, breadcrumbs, and shared web application state.

Package info

github.com/Websonette/web-application

pkg:composer/websonette/web-application

Statistics

Installs: 34

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-08-27 13:04 UTC

This package is auto-updated.

Last update: 2026-09-24 06:34:34 UTC


README

Framework-independent request-scoped state shared by Websonette application adapters.

The package is currently being prepared and does not have a stable public API yet.

Scope

The package contains data and operations only. It does not depend on Nette, Latte, React, HTML, sessions, or a particular response format.

  • Websonette\WebApplication\Breadcrumbs\Breadcrumbs manages an ordered breadcrumb trail identified by URL.
  • Websonette\WebApplication\Page\PageContext describes the current page and exposes a serializable SPA-friendly contract.

Rendering and framework integration belong to adapter packages such as websonette/latte-application and the Nette/Contributte Apitte plus React adapter websonette/react-spa-application.

The repository also carries development tooling without coupling it to the runtime:

  • contracts/ contains versioned JSON Schemas for PageContext, breadcrumbs, and their SPA application envelope;
  • docs/standards/ defines standards common to all Websonette web projects;
  • skills/ contains adapter-neutral Cursor workflows for creating, updating, and auditing projects;
  • adapter repositories own their project profiles and framework-specific references.

See Architecture and Project profiles. The dependency direction remains project -> adapter -> web-application.

Breadcrumbs

use Websonette\WebApplication\Breadcrumbs\Breadcrumbs;

$breadcrumbs = new Breadcrumbs();
$breadcrumbs->add('Homepage', '/', 'home', 'Introduction');
$breadcrumbs->add('Products', '/products', 'box');

Page context

use Websonette\WebApplication\Page\PageContext;

$page = (new PageContext())
    ->setTitle('Products')
    ->setHeading('Our products')
    ->setDescription('Product overview')
    ->setCanonicalUrl('https://example.com/products')
    ->addAlternateUrl('cs', 'https://example.com/cs/produkty')
    ->setProperty('og:title', 'Products');

Both services provide toArray() output suitable for a framework-specific JSON response.

For an SPA response, use the versioned envelope defined by contracts/application-context.schema.json:

return new JsonResponse([
    'contractVersion' => 1,
    'page' => $page->toArray(),
    'breadcrumbs' => $breadcrumbs->toArray(),
]);

Installation

After the first release and Packagist registration:

composer require websonette/web-application

License

Websonette Web Application is licensed under the MIT License.