Download the PHP package fahara02/udb-laravel without Composer

On this page you can find all versions of the php package fahara02/udb-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package udb-laravel

UDB Laravel SDK

UDB :: Universal Data Broker
gRPC data plane | native control plane | tenant/project scope guard
crate v0.5.21 | protocol v1.0.0

Packagist PHP Version Laravel

Laravel client for UDB, a service that lets your app read and write data through one broker instead of connecting directly to every database or storage backend.

Install this package when a Laravel app needs to call a running UDB broker. It gives you a Laravel ServiceProvider, a Udb facade, generated PHP protobuf classes, request middleware, and clear exceptions for gRPC errors.


What is UDB?

UDB stands for Universal Data Broker. Think of it as a data API that sits between your Laravel app and the systems where the data actually lives.

A Laravel app sends a request such as "select patients", "upsert this invoice", or "delete this object". UDB decides where that data lives, applies the broker rules, talks to the right backend, and returns a typed response.

That means the Laravel app does not need to know whether the data is in Postgres, MySQL, SQLite, MongoDB, S3, Redis, Qdrant, or another supported backend. The app only needs the UDB endpoint and the request it wants to send.

What This Package Does

This package makes UDB feel natural inside Laravel:


Requirements


Installation

The service provider is auto-discovered by Laravel. The Udb facade is registered automatically. By default, the package also adds middleware to the web and api route groups so each request can carry tenant and user context into UDB.

The package also installs a version-matched CLI launcher at vendor/bin/udb. Use it from your Laravel project when you need UDB's shared annotation protos:

After that, your app-owned .proto files can import:

Run vendor/bin/udb proto fmt after export or schema edits to keep long UDB field annotations on one line for easier review.

Publish the config file when you need to override defaults:

This drops a documented config/udb.php into your app.


Configuration

For local development, the only required value is usually:

For production, you will normally set TLS, service identity, project, and timeout values too:

The full reference lives in config/udb.php.

UDB_ENDPOINT accepts either a host:port value or a Unix-domain-socket target (unix:///var/run/udb.sock) for a co-located broker sidecar — see Performance below.


Performance

PHP-FPM is shared-nothing: it tears down the worker after every request, so a normal PHP UDB client opens a new gRPC channel per request and re-pays the TCP + TLS + HTTP/2 handshake every time (grpc#15426). That re-handshake is the dominant PHP latency against a gRPC broker.

The fix is to hold a warm channel in a persistent-worker runtime (OpenSwoole / RoadRunner / FrankenPHP) that builds the client once and reuses it across requests, and/or to run a local UDB sidecar reached over a Unix domain socket. See:

Worker keepalive env (set these for a persistent-worker deployment so the warm channel isn't dropped to IDLE and re-handshaked):


Usage

Read Data

If the call happens during an HTTP request, the middleware will try to attach the current tenant, user, and correlation ID automatically.

Write Data

upsert() returns a MutationResponse.

Delete Data

delete() also returns a MutationResponse.

Idempotency Replay And Read-Your-Writes

A keyed replay-safe mutation the broker deduplicated reports was_duplicate; the write receipt on the response fences a follow-up read (full contract: docs/native-services.md).

Retry contract: a replay-safe mutation is retried on transient errors only when the request carries a non-empty idempotency key — keyless mutations fail closed rather than risk a double apply.

Queue Jobs And Scheduled Commands

Jobs, commands, and schedulers do not have an HTTP request, so pass metadata explicitly:

Storage (upload & download)

The framework-agnostic UdbProject exposes a storage() facade over the generated StorageService. Build it with createUdb() (or UdbProject::connect()), then use the convenience wrappers:

Download — happy path (presigned URL). downloadFile() emits exactly one GetDownloadUrl RPC and returns the typed GetDownloadUrlResponse; the bytes never transit the broker. Hand the URL to the client / browser:

Download — streaming fallback (new in 0.3.6). When the client cannot reach the object store over HTTP (no egress, corporate proxy), pull the raw bytes through the broker with the server-streaming DownloadFile RPC. downloadFileBytes() opens one server-stream and reassembles each DownloadFileChunk.data run in order:

For RPCs without a wrapper, reach the generated stub via $storage->client(). A runnable end-to-end upload-then-download script lives at examples/storage-download.php.

Raw gRPC Stub

For broker RPCs that do not have a convenience method yet, use the generated gRPC stub:

Platform Services (Vault, Metering, Scheduler, …)

Vault, Metering, Scheduler, Search, Webhook, Workflow, Lock, LiveQuery, Config, Backup, and Embedding have no convenience wrappers yet — reach their buf-generated stubs through the generated client's per-service accessors (VaultServiceStub(), MeteringServiceStub(), …), which share one channel, metadata, and TLS configuration:

The per-RPC retry class and idempotency contract are listed in docs/generated/udb-native-contract.json.

Error handling


Per-request context

The shipped UdbContextMiddleware resolves three values from each incoming HTTP request and binds them to the singleton client so subsequent RPC calls inherit them:

Value Default resolver Header fallback
tenant_id $request->user()->tenant_id X-Tenant-Id
user_id $request->user()->getAuthIdentifier() X-User-Id
correlation_id X-Correlation-Id header freshly generated v4 UUID

Override the resolvers by binding the same container keys in your AppServiceProvider:


Testing

The SDK ships with Pest tests + an Orchestra Testbench base class. For your own app's tests, swap the UdbClient binding for a fake:

Run the SDK's own tests:


Versioning & compatibility

This SDK follows the UDB wire-protocol version — see UDB_PROTOCOL_VERSION in the parent sdk/ directory. Major SDK versions track major broker versions; minor SDK versions add convenience methods and Laravel-idiomatic helpers.

The current wire protocol is 1.0.0.


License

MIT © fahara02


All versions of udb-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-grpc Version *
grpc/grpc Version ^1.57
google/protobuf Version ^4.33.6
illuminate/contracts Version ^10.0|^11.0|^12.0
illuminate/support Version ^10.0|^11.0|^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package fahara02/udb-laravel contains the following files

Loading the files please wait ...