Applications provides a fundamental interface to configure your application based on request patterns.
Applications are defined using the applications
stream. Entries are defined using JSON
entry files within the /streams/apps
directory by default.
The match
value is compared to request URLs to determine the active application.
// streams/apps/docs.json
{
"match": "docs.example.com/*"
}
The following application options are available and support parsing variables.
Set the active locale using the locale property:
// streams/apps/docs.json
{
"match": "docs.example.com/*",
"locale": "en"
}
Override configuration using the config property:
// streams/apps/docs.json
{
"match": "docs.example.com/*",
"config": {
"app.name": "Documentation"
}
}
You can overload streams using the streams property:
// streams/apps/docs.json
{
"match": "docs.example.com/*",
"streams": {
"pages": {
"source.path": "streams/data/pages/docs"
}
}
}
Use the assets property to register assets by name:
// streams/apps/docs.json
{
"match": "docs.example.com/*?preview=darkmode",
"assets": {
"variable": "epic/script.js",
"theme.css": "your/theme/dark.css",
"theme.js": "your/theme/dark.js",
"theme-bundle": ["theme.css", "theme.js"]
}
}
@verbatim{{ Asset::load("random") }}
{{ Asset::load("theme-bundle") }}@endverbatim
Use the routes property to register routes by middleware group:
// streams/apps/docs.json
{
"match": "docs.example.com/*?preview=login",
"routes": {
"web": {
"/login": {
"uses": "App\\Http\\Controller\\Alternate@login"
}
}
}
}
Use the policies property to register policies by name:
// streams/apps/docs.json
{
"match": "docs.example.com/*?preview=login",
"policies": {
"custom-testing-array-policy": ["Your\\Policy", "method"],
"custom-testing-invokable-policy": "You\\InvokablePolicy",
"CustomProviderService::class": "Your\\Policy"
}
}
Use the listeners property to register listeners by event name:
// streams/apps/docs.json
{
"match": "docs.example.com/*?preview=feature",
"events": {
"example.event": [
"App\\Event\\Listener\\FeatureListener"
]
}
}
The providers
property specifies service providers to register.
// streams/apps/docs.json
{
"match": "docs.example.com/*?preview=feature",
"providers": [
"App\\Providers\\FeatureProvider"
]
}
The middleware
property specifies grouped middleware to register.
// streams/apps/docs.json
{
"match": "docs.example.com/*?preview=feature",
"middleware": {
"web": [
"App\\Http\\Middleware\\ExampleMiddleware"
]
}
}
The commands
property specifies Artisan commands to register.
// streams/apps/docs.json
{
"match": "docs.example.com/*?preview=feature",
"commands": [
"App\\Console\\ExampleCommand"
]
}
The schedules
property specifies scheduled commands to register.
// streams/apps/docs.json
{
"match": "docs.example.com/*?preview=feature",
"schedules": {
"* * * * *": [
"App\\Console\\ExampleCommand",
],
"dailyAt|13:00": [
"App\\Console\\AnotherCommand",
]
}
}
Applications provide the backbone functionality for building multi-tenancy applications.
// streams/apps/accounts.json
{
"match": "*.example.com/*",
"config": {
"app.name": "My Account",
"database.default": "{request.parsed.domain.0}",
"streams.core.data_path": "streams/data/{request.parsed.domain.0}"
},
"users": {
"source.table": "users_{request.parsed.domain.0}"
}
}
Application switching provides the backbone functionality for building localized applications.
// streams/apps/localized.json
{
"match": "*.example.com/*",
"locale": "{request.parsed.domain.0}",
"pages": {
"source.path": "streams/data/pages/{request.parsed.domain.0}"
}
}
A blank TALL-stack Laravel project with Streams.
The fundamental features and utilities offered by the Streams platform.
A universal and extensible RESTful API for Streams.
Extensible, user-friendly, and performant control panel, components, and services.
Dev tooling for Laravel Streams.