Download the PHP package swarakaka/bridge-laravel without Composer

On this page you can find all versions of the php package swarakaka/bridge-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 bridge-laravel

swarakaka/bridge-laravel

Laravel package for the Bridge protocol: one controller action, served as an HTML shell, a Bridge page object, or a JSON API document depending on the request's Accept header, plus first-class server-sent event streams.

Requires PHP 8.4+ and Laravel 13.

Install

The bridge middleware is appended to the web group automatically (bridge.middleware.auto_register). Set bridge.shell.view to app to use the published shell, or keep the package default bridge::app.

The shell marks where the client mounts, either with directives or with Blade components (identical output; the components accept attributes):

<x-bridge::app> accepts id (default bridge.shell.root_id), :page (defaults to the current response's page; false for an empty root) and :ssr-body; <x-bridge::head> accepts :protocol, build and :ssr-head.

Usage

Bridge\Bridge is a facade over the Bridge\BridgeManager singleton (also bound as bridge). Type-hint BridgeManager for dependency injection. Bridge\Facades\Bridge still works but is deprecated since 2.0; see UPGRADE.md.

Request index() returns store() returns
Accept: text/html HTML shell with the page object embedded in #bridge-page 302 redirect
Accept: application/vnd.bridge+json; v=1 { "type": "page", "component": "Customers/Index", "url", "props", "build", "deferred" } 303 + Location
Accept: application/json { "data": { "customers": {...}, "filters": {...}, "stats": {...} } } 201 + Location + { "data": {...}, "meta": { "location", "flash" } }
Accept: text/event-stream 406 (rendering route) 406

No mode-specific code exists in controllers. Validation and other exceptions are mapped centrally: 422 with a Bridge error object in page mode, Laravel-native { message, errors } in JSON mode, Laravel's redirect-back in HTML mode.

Props

JSON root

Bridge::render('Customers/Show', [...])->jsonRoot('customer') makes that prop the data root in JSON mode and moves the other props to meta.

Partial reloads

Send X-Bridge-Only: customers,stats (or X-Bridge-Except) with X-Bridge-Component: Customers/Index. Dot keys (customers.data) select nested values. A component mismatch returns a full page.

Build version

X-Bridge-Build on GET page requests is compared with Bridge::version() (config bridge.build.version, BRIDGE_BUILD_VERSION, or the Vite manifest hash). A mismatch returns 409 with X-Bridge-Location so the client reloads.

Caching

Page and JSON responses are private, no-cache with a weak ETag (304 on If-None-Match). Opt in per response with ->cache(maxAge: 60, public: true); public is refused for authenticated users unless force: true.

CSRF for bearer clients on web routes

Replace the CSRF middleware in the web group with Bridge\Http\Middleware\VerifyCsrfToken. It skips verification only for requests that carry Authorization: Bearer … and no session cookie, so cookie sessions keep full protection.

Testing

TestResponse macros: assertBridgePage($component, fn (AssertablePage $page) => ...), assertBridgeProp($key, $value), assertBridgeError($status, $kind), assertJsonMode(), assertHtmlShell().

Streams (SSE)

Bus drivers: redis (Redis Streams, replay with Last-Event-ID), database (polling, no Redis; use SQLite WAL), sync, null. Apply throttle:bridge-stream to stream routes (bridge.stream.connects_per_minute); client-requested ?channels= are capped (bridge.stream.max_client_channels). Connections end after max_duration_s with end{reconnect:true} so workers recycle; heartbeats are : hb comments. bridge:doctor checks the runtime, bridge:stream:prune trims the database bus, Bridge::streamTicket() issues signed URLs for clients that cannot send headers. See the deployment guide (docs/realtime/deployment.md, published on the docs site).

Server-side rendering

Build the SSR bundle with Vite (vite build --ssr resources/js/ssr.ts --outDir bootstrap/ssr) and run php artisan bridge:ssr. HTML requests POST the page object to the SSR server and embed its {head, body}; failures fall back to client rendering. After upgrading, run php artisan view:clear so the compiled @bridge directives pick up the SSR arguments.

Protocol

The normative specification, JSON Schemas and golden fixtures live in packages/protocol. This package's conformance suite asserts it produces those fixtures exactly.


All versions of bridge-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
laravel/framework Version ^13.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 swarakaka/bridge-laravel contains the following files

Loading the files please wait ...