Download the PHP package tobento/apps without Composer
On this page you can find all versions of the php package tobento/apps. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package apps
Short Description Multiple apps support. Each app will run in its own application.
License MIT
Homepage https://www.tobento.ch
Informations about the package apps
Apps
Multiple apps support. Each app will run in its own application.
Table of Contents
- Getting Started
- Requirements
- Documentation
- App
- Creating A New App
- Booting Apps
- Apps Config
- Directory Structure
- Sharing Configurations
- Accessing Apps
- App Finder
- Console
- Apps List Command
- Apps Command
- Apps Create Console Command
- Testing
- Credits
Getting Started
Add the latest version of the apps project running this command.
Requirements
- PHP 8.4 or greater
Documentation
App
Check out the App Skeleton if you are using the skeleton.
You may also check out the App to learn more about the app in general.
Creating A New App
To create a new app, simply extend the and define the constants as you need it.
Allow Sub Apps
If your app supports sub apps, set the property to .
Booting Apps
After creating your apps, you will need to boot your apps:
Example Using Apps Within A Boot
Next, boot your boot:
Apps Config
The configuration for the apps is located in the file at the default App Skeleton config location.
Directory Structure
The directory structure will be like:
Sharing Configurations
You may share configurations between apps using the or directory to point to the same directory:
In each app :
And within your app:
Accessing Apps
You may access apps from within another app by using the to retrieve the desired app.
Sub Apps
When accessing a sup app, you will need to boot the parent app first, otherwise the sub app will not be found!
CAUTION When booting multiple apps, you will need to reboot the main app using the method afterwards, otherwise helper functions will use last booted app container for instance.
App Finder
The AppFinder allows you to locate and boot apps anywhere in an app tree.
It supports both direct lookup and full recursive search.
Purpose
Apps are organized in a tree structure.
Sub-apps are only discoverable after booting their parent.
AppFinder provides a convenient way to locate an app by its ID and return it in a booted and active context.
Container Context Behavior
Booting an app switches the active container.
This affects all helper functions such as:
config()trans()
When AppFinder returns an app, that app remains the active context.
This is intentional: callers typically want to work inside the app they just found.
If you want to switch back to the previous app (usually the main app), you must explicitly call:
This restores the original container context.
findById(string $id): null|AppInterface
Performs a fast lookup among the current app and its direct children.
- Returns the app in a booted and active state.
- Does not restore the previous app context.
- Supports the special virtual identifier "root".
Use this when you know the app is a direct child or the root app.
findByIdRecursive(string $id): null|AppInterface
Searches the entire app tree using a depth-first traversal.
- Boots apps only when needed to discover their sub-apps.
- Avoids booting the same app more than once using a visited list.
- Returns the found app in a booted and active state.
- Does not restore the previous app context when returning an app.
- Restores the previous app context only when returning
null. - Supports the special virtual identifier "root".
Use this when apps may be nested multiple levels deep.
Summary
- Returned apps are booted and active.
- The main app is not restored automatically when returning an app.
- You must manually restore the previous app if you want to switch back.
- Recursive search explores the entire tree using depth-first traversal.
"root"is a virtual identifier and is handled explicitly.
Console
The following commands should be run only on the root app console.
Apps List Command
The command provides an overview of all the apps:
Apps Command
With the command you can run any command within each apps.
Runs command on all apps:
Runs command on the frontend and backend app only:
Apps Create Console Command
You may create for each app a console using the command.
Once created, the console is available at each app directory:
Testing
When using the App Testing bundle, you need to return the specific app you want to test on the method:
Using The Tmp App
Example using a sub app:
Credits
- Tobias Strub
- All Contributors
All versions of apps with dependencies
tobento/app Version ^2.0
tobento/app-migration Version ^2.0
tobento/app-http Version ^2.0
tobento/app-console Version ^2.0