PHPackages                             tcgunel/ucp-laravel - 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. [API Development](/categories/api)
4. /
5. tcgunel/ucp-laravel

ActiveLibrary[API Development](/categories/api)

tcgunel/ucp-laravel
===================

Universal Commerce Protocol (UCP) for Laravel — expose your storefront to AI shopping agents.

v0.3.0(2w ago)00MITPHPPHP ^8.2CI passing

Since May 20Pushed 2w agoCompare

[ Source](https://github.com/tcgunel/ucp-laravel)[ Packagist](https://packagist.org/packages/tcgunel/ucp-laravel)[ Docs](https://github.com/tcgunel/ucp-laravel)[ RSS](/packages/tcgunel-ucp-laravel/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (8)Versions (4)Used By (0)

UCP for Laravel
===============

[](#ucp-for-laravel)

> Expose any Laravel storefront to AI shopping agents through Google's **Universal Commerce Protocol (UCP)**.

[![Tests](https://github.com/tcgunel/ucp-laravel/actions/workflows/tests.yml/badge.svg)](https://github.com/tcgunel/ucp-laravel/actions/workflows/tests.yml)[![PHP](https://camo.githubusercontent.com/08f365152a45f6abffd9e4bfafa3b608a0733bf3cf58d94ea2fecc0fef91638e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e322d373737626234)](https://www.php.net/)[![Laravel](https://camo.githubusercontent.com/48ddf9b87dee7edd1fa7b3e997fd8e8b0f46d93cb7cc065f34d0f523d558fe70/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d3131253230253743253230313225323025374325323031332d666632643230)](https://laravel.com/)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](LICENSE)

The [Universal Commerce Protocol](https://ucp.dev) is the open standard — announced by Google in January 2026 and developed with Shopify, Etsy, Wayfair, Target and Walmart — that lets AI agents (Google AI Mode, Gemini, and others) discover and buy from a store programmatically.

`ucp-laravel` makes your application **UCP-native**. You implement small per-capability contracts that map your products and orders onto the UCP schema; the package serves the discovery manifest, the capability endpoints, validation, and the response envelopes.

---

Capabilities
------------

[](#capabilities)

The package implements the full UCP **`2026-04-08`** shopping capability surface over the REST binding:

CapabilityUCP identifierStatusDiscovery manifest`/.well-known/ucp`✅Catalog — search / lookup / detail`dev.ucp.shopping.catalog`✅Cart`dev.ucp.shopping.cart`✅Checkout`dev.ucp.shopping.checkout`✅Discount`dev.ucp.shopping.discount`✅Fulfillment`dev.ucp.shopping.fulfillment`✅Order — lookup + webhooks`dev.ucp.shopping.order`✅Identity Linking — OAuth 2.0`dev.ucp.common.identity_linking`✅AP2 Mandates — agent payments`dev.ucp.shopping.ap2_mandate`✅Security-critical pieces stay in your application, behind contracts: the package **never captures payment**, **never implements an OAuth server**, and **never owns your signing keys**. Checkout completion, the OAuth `/oauth2/*` endpoints and the ES256 crypto are delegated to provider contracts you implement.

> **Spec note.** UCP is young and its schemas are still moving. This package mirrors the `2026-04-08` revision; treat the JSON shapes as a faithful implementation, not a frozen guarantee. Verify against [ucp.dev](https://ucp.dev) before going to production.

---

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11, 12 or 13

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

[](#installation)

Once published to Packagist:

```
composer require tcgunel/ucp-laravel
```

While the package is consumed privately across projects, add it as a path or VCS repository — see [docs/installation.md](docs/installation.md).

Publish the config file (optional — the package works with sensible defaults):

```
php artisan vendor:publish --tag=ucp-config
```

The service provider is auto-discovered. The UCP routes are live immediately; each capability stays dormant — and unadvertised in the manifest — until you configure its provider.

Quick start
-----------

[](#quick-start)

Each capability is one contract. Start with **Catalog** — it is read-only and the fastest to ship:

```
namespace App\Ucp;

use App\Models\Product as Listing;
use Tcgunel\Ucp\Contracts\CatalogProvider;
use Tcgunel\Ucp\DTO\Availability;
use Tcgunel\Ucp\DTO\Money;
use Tcgunel\Ucp\DTO\PriceRange;
use Tcgunel\Ucp\DTO\Product;
use Tcgunel\Ucp\DTO\RequestContext;
use Tcgunel\Ucp\DTO\SearchQuery;
use Tcgunel\Ucp\DTO\SearchResult;
use Tcgunel\Ucp\DTO\Variant;

final class EloquentCatalogProvider implements CatalogProvider
{
    public function search(SearchQuery $query): SearchResult
    {
        $listings = Listing::query()
            ->when($query->hasQuery(), fn ($q) => $q->where('name', 'like', "%{$query->query}%"))
            ->limit($query->pagination->limit)
            ->get();

        return new SearchResult(products: $listings->map($this->toUcpProduct(...))->all());
    }

    public function lookup(array $ids, RequestContext $context): array
    {
        return Listing::query()->findMany($ids)->map($this->toUcpProduct(...))->all();
    }

    public function product(string $id, array $selected, array $preferences, RequestContext $context): ?Product
    {
        $listing = Listing::query()->find($id);

        return $listing instanceof Listing ? $this->toUcpProduct($listing) : null;
    }

    private function toUcpProduct(Listing $listing): Product
    {
        $price = new Money((int) $listing->price_in_kurus, 'TRY');

        return new Product(
            id: (string) $listing->id,
            title: $listing->name,
            description: $listing->description ?? '',
            priceRange: PriceRange::uniform($price),
            variants: [
                new Variant(
                    id: (string) $listing->id,
                    title: $listing->name,
                    price: $price,
                    availability: $listing->stock > 0
                        ? Availability::inStock($listing->stock)
                        : Availability::outOfStock(),
                ),
            ],
        );
    }
}
```

Register it:

```
// config/ucp.php
'catalog_provider' => \App\Ucp\EloquentCatalogProvider::class,
```

Every other capability follows the same shape — implement a contract, register it under its config key. See the guides below.

Endpoints
---------

[](#endpoints)

Method &amp; pathCapability`GET /.well-known/ucp`discovery manifest`GET /.well-known/oauth-authorization-server` · `/.well-known/oauth-protected-resource`Identity Linking`POST /catalog/search` · `/catalog/lookup` · `/catalog/product`Catalog`POST /carts` · `GET·PUT /carts/{id}` · `POST /carts/{id}/cancel`Cart`POST /checkout-sessions` · `GET·PUT /checkout-sessions/{id}` · `POST …/complete` · `…/cancel`Checkout`GET /orders/{id}`OrderCatalog requests reject malformed input with `422`. For cart, checkout and order, **business outcomes return `200` with a `messages[]` array** — the UCP convention — while only protocol-level problems use HTTP error statuses. Order-lifecycle updates are pushed to agents as signed webhooks.

How it works
------------

[](#how-it-works)

```
   AI shopping agent
          │
          ├── GET /.well-known/ucp ──────────► ManifestController ──► ManifestBuilder
          │                                    (advertises only configured capabilities)
          │
          ├── GET /.well-known/oauth-* ───────► IdentityController ──► IdentityLinkProvider
          │
          └── POST /catalog · /carts · ───────► capability controller
              /checkout-sessions · GET /orders        (validate → DTO)
                                                       │
                                                       ▼
                              Catalog · Cart · Checkout · Order providers  ← YOUR CODE

```

The package owns the protocol — routing, the manifest, request validation, the `ucp`response envelope, the JSON schema. Your application owns the data, the OAuth server and the crypto, through small contracts. Controllers stay thin; DTOs are immutable; every capability is an interface.

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

[](#documentation)

GuideContents[Installation](docs/installation.md)Composer setup, publishing, what gets registered[Configuration](docs/configuration.md)Every `config/ucp.php` key[Catalog provider](docs/catalog-provider.md)The catalog contract, the DTOs, money precision[Cart &amp; checkout providers](docs/checkout-provider.md)The session contracts, lifecycle, discounts, fulfilment, payment[Order, Identity &amp; AP2](docs/order-and-identity.md)Order webhooks, OAuth discovery, AP2 mandates[Multi-tenancy](docs/multi-tenancy.md)Per-tenant manifests and capabilities[Manifest reference](docs/manifest-reference.md)The `/.well-known/ucp` JSON structure[Roadmap](docs/roadmap.md)What's nextMulti-tenancy
-------------

[](#multi-tenancy)

The package is built for multi-tenant SaaS. Endpoint URLs in the manifest follow the request host, so per-tenant domains work with zero extra wiring. See [docs/multi-tenancy.md](docs/multi-tenancy.md).

Testing
-------

[](#testing)

```
composer test
```

The suite runs against [Orchestra Testbench](https://github.com/orchestral/testbench); no host application is required.

Code quality
------------

[](#code-quality)

ToolCommandStandard[Pint](https://laravel.com/docs/pint)`composer lint` / `composer format`Laravel preset + strict types[PHPStan](https://phpstan.org) (Larastan)`composer analyse`Level 8[PHPUnit](https://phpunit.de)`composer test`—`composer check` runs all three.

Contributing
------------

[](#contributing)

Bug reports and pull requests are welcome. Please run `composer check` before opening a PR. See [CHANGELOG.md](CHANGELOG.md) for release history.

License
-------

[](#license)

The MIT License. See [LICENSE](LICENSE).

Credits
-------

[](#credits)

- Built by [Tolga Can Günel](https://github.com/tcgunel).
- Implements the [Universal Commerce Protocol](https://ucp.dev) — a project of Google and the broader commerce community.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance96

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

Every ~0 days

Total

3

Last Release

20d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/36dffe883e88aeef07c26067af3d6a7eda1c2a81f1ae45fdd430b721665131da?d=identicon)[Mobius Studio](/maintainers/Mobius%20Studio)

---

Top Contributors

[![tcgunel](https://avatars.githubusercontent.com/u/3923425?v=4)](https://github.com/tcgunel "tcgunel (3 commits)")

---

Tags

laravelagentic commerceucpuniversal-commerce-protocolai-shoppinggoogle-ucp

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/tcgunel-ucp-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/tcgunel-ucp-laravel/health.svg)](https://phpackages.com/packages/tcgunel-ucp-laravel)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

76318.2M110](/packages/laravel-mcp)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

815320.5k3](/packages/defstudio-telegraph)[api-platform/laravel

API Platform support for Laravel

59156.3k10](/packages/api-platform-laravel)[simplestats-io/laravel-client

Analytics for Laravel. Track visitors, registrations, and payments. Discover which channels actually drive revenue, not just traffic. Server-side, GDPR compliant, ad-blocker proof.

5019.3k](/packages/simplestats-io-laravel-client)[laravel/surveyor

Static analysis tool for Laravel applications.

8390.3k12](/packages/laravel-surveyor)

PHPackages © 2026

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