### Installer Class Documentation Source: https://api.docs.flarum.org/php/main/Flarum/Install/Installer Provides details about the Installer class, including its constructor and methods. ```APIDOC ## Installer Class ### Description Represents the installer for the Flarum application, implementing the AppInterface. ### Methods #### `__construct(Container $container)` ##### Description Constructor for the Installer class. ##### Parameters - **container** (Container) - The dependency injection container. #### `getRequestHandler(): RequestHandlerInterface` ##### Description Retrieves the request handler for the application. ##### Return Value - **RequestHandlerInterface** - The application's request handler. #### `getConsoleCommands(): Command[]` ##### Description Retrieves the console commands available for the application. ##### Return Value - **Command[]** - An array of console commands. ``` -------------------------------- ### Installation Class Methods Source: https://api.docs.flarum.org/php/main/Flarum/Install/Installation This section details the methods available within the Flarum Installation class for configuring various aspects of the installation process. ```APIDOC ## POST /install ### Description This endpoint represents the Flarum installation process. It allows for the configuration of database settings, base URL, admin user, and enabled extensions. ### Method POST ### Endpoint /install ### Parameters #### Request Body - **paths** (Paths) - Required - Specifies the paths for Flarum installation. - **dbConfig** (DatabaseConfig) - Required - Configuration details for the database connection. - **baseUrl** (BaseUrl) - Required - The base URL for the Flarum installation. - **adminUser** (AdminUser) - Required - Details for the initial administrator user. - **settings** (object) - Optional - General Flarum settings. - **enabledExtensions** (array) - Optional - A list of extensions to be enabled upon installation. - **accessToken** (string) - Optional - An access token for specific installation scenarios. ### Request Example ```json { "paths": { "basePath": "/var/www/html", "storagePath": "/var/www/html/storage" }, "dbConfig": { "driver": "mysql", "host": "localhost", "database": "flarum", "username": "flarum_user", "password": "secret" }, "baseUrl": { "url": "http://localhost" }, "adminUser": { "username": "admin", "password": "password", "email": "admin@example.com" }, "settings": { "forum_title": "My Flarum Forum" }, "enabledExtensions": [ "flarum-suspend", "flarum-tags" ], "accessToken": "your_access_token" } ``` ### Response #### Success Response (200) - **message** (string) - A success message indicating the installation is complete. #### Response Example ```json { "message": "Flarum installation successful." } ``` #### Error Response (400) - **error** (string) - A message describing the installation error. #### Error Response Example ```json { "error": "Database connection failed. Please check your credentials." } ``` ``` -------------------------------- ### Initializing Database from Schema Source: https://api.docs.flarum.org/php/main/Flarum/Database/Migrator Sets up the Flarum database schema from a provided schema dump file. This is typically used during the initial installation or setup process. ```php public function installFromSchema(string $path) { // ... install from schema logic ... } ``` -------------------------------- ### Server Listen Method Source: https://api.docs.flarum.org/php/main/doc-index Starts the server to listen for incoming requests. ```APIDOC ## Server Listen Method ### Description Initiates the server to listen for and handle incoming HTTP requests. ### Method `listen` ### Endpoint N/A (Method call) ### Parameters N/A ### Request Example ```php Server::listen(); ``` ### Response N/A (This method typically runs the server indefinitely or until stopped.) ``` -------------------------------- ### InstallController Constructor (PHP) Source: https://api.docs.flarum.org/php/main/Flarum/Install/Controller/InstallController Initializes the InstallController with necessary dependencies for installation and session management. It requires instances of Installation, SessionAuthenticator, and Rememberer. ```php class InstallController implements RequestHandlerInterface { protected Installation | $installation; protected SessionAuthenticator | $authenticator; protected Rememberer | $rememberer; public function __construct(Installation $installation, SessionAuthenticator $authenticator, Rememberer $rememberer) { $this->installation = $installation; $this->authenticator = $authenticator; $this->rememberer = $rememberer; } } ``` -------------------------------- ### WriteSettings Class Implementation (PHP) Source: https://api.docs.flarum.org/php/main/Flarum/Install/Steps/WriteSettings This PHP code defines the WriteSettings class, which implements the Step interface for Flarum's installation. It includes a constructor to set up the database connection and custom settings, a getMessage method to return a status string, and a run method to perform the installation step, potentially throwing a StepFailed exception. ```php class WriteSettings implements Step { /** * @var ConnectionInterface */ protected $database; /** * @var array */ protected $custom; /** * @param ConnectionInterface $database * @param array $custom */ public function __construct(ConnectionInterface $database, array $custom) { $this->database = $database; $this->custom = $custom; } /** * @inheritDoc */ public function getMessage() { return 'Writing settings'; } /** * @inheritDoc */ public function run() { // Implementation for writing settings goes here. // This method should raise a StepFailed exception whenever something goes wrong // that should result in the entire installation being reverted. throw new StepFailed('This is a placeholder exception.'); } } ``` -------------------------------- ### Step Interface Source: https://api.docs.flarum.org/php/main/Flarum/Install/Step Documentation for the 'Step' interface within the Flarum installation process. This interface defines the contract for individual installation steps. ```APIDOC ## Step Interface ### Description Represents a single step in the Flarum installation process. ### Methods #### getMessage() ##### Description Returns a one-line status message summarizing the current state of the step. ##### Method ``` string getMessage() ``` ##### Return Value - string: A status message. #### run() ##### Description Executes the work required for this installation step. This method should throw a `StepFailed` exception if the step encounters an error that requires the entire installation to be reverted. ##### Method ``` void run() ``` ##### Return Value - void ##### Exceptions - StepFailed: Thrown when the step fails and the installation needs to be reverted. ``` -------------------------------- ### HttpFormatter::format Method Implementation Example Source: https://api.docs.flarum.org/php/main/Flarum/Foundation/ErrorHandling/HttpFormatter An example implementation of the format method for the HttpFormatter interface. This method takes a HandledError and a ServerRequestInterface to generate an appropriate HTTP response. ```php public function format(HandledError $error, ServerRequestInterface $request): ResponseInterface { // Implementation to create an HTTP response based on the error and request // For example, returning a JSON response with error details. $response = new PsrHttpMessageResponseInterface; $response->getBody()->write(json_encode(['error' => $error->getMessage()])); return $response->withHeader('Content-Type', 'application/json')->withStatus(500); } ``` -------------------------------- ### DataProviderInterface configure Method (PHP) Source: https://api.docs.flarum.org/php/main/Flarum/Install/Console/DataProviderInterface The DataProviderInterface defines a 'configure' method used for setting up installations. It accepts an Installation object as a parameter and returns an Installation object. This interface is crucial for managing installation processes within the Flarum framework. ```php interface DataProviderInterface { public function configure(Installation $installation): Installation; } ``` -------------------------------- ### Get Container Source: https://api.docs.flarum.org/php/main/Flarum/Api/Controller/AbstractCreateController Retrieves the service container instance. ```APIDOC ## GET /api/container ### Description Retrieves the application's service container instance. This can be used to access various services and dependencies. ### Method GET ### Endpoint /api/container ### Parameters None ### Request Example ```json // No request body needed. ``` ### Response #### Success Response (200) - **Container** (Container) - The service container instance. #### Response Example ```json { "container": "Container object" } ``` ``` -------------------------------- ### Boot Application Source: https://api.docs.flarum.org/php/main/Flarum/Foundation/InstalledSite Creates and boots a Flarum application instance using the InstalledSite. ```APIDOC ## POST /installedsite/bootapp ### Description Creates and boots a Flarum application instance. ### Method POST ### Endpoint /installedsite/bootapp ### Parameters #### Request Body - **instance** (InstalledSite) - Required - The InstalledSite instance to use for booting. ### Request Example { "instance": "" } ### Response #### Success Response (200) - **app** (AppInterface) - The booted Flarum application instance. #### Response Example { "app": "" } ``` -------------------------------- ### Boot Application Instance Source: https://api.docs.flarum.org/php/main/Flarum/Foundation/UninstalledSite Creates and boots a Flarum application instance. ```APIDOC ## POST /websites/api_flarum_php_main/UninstalledSite/bootApp ### Description Creates and boots a Flarum application instance. ### Method POST ### Endpoint /websites/api_flarum_php_main/UninstalledSite/bootApp ### Parameters (No parameters) ### Request Example ```json { "example": "No request body needed" } ``` ### Response #### Success Response (200) - **AppInterface** (AppInterface) - The booted application instance. #### Response Example ```json { "example": "AppInterface object" } ``` ``` -------------------------------- ### Check Extension Installation Status (PHP) Source: https://api.docs.flarum.org/php/main/Flarum/Extension/Extension Determines if the Flarum extension is currently installed. This method returns a boolean value indicating the installation status. ```php public function isInstalled(): bool ``` -------------------------------- ### InstalledSite Constructor Source: https://api.docs.flarum.org/php/main/Flarum/Foundation/InstalledSite Initializes a new instance of the InstalledSite class with provided Paths and Config objects. ```APIDOC ## POST /installedsite/construct ### Description Initializes a new instance of the InstalledSite class. ### Method POST ### Endpoint /installedsite/construct ### Parameters #### Request Body - **paths** (Paths) - Required - The paths object for the application. - **config** (Config) - Required - The configuration object for the application. ### Request Example { "paths": "", "config": "" } ### Response #### Success Response (200) - **instance** (InstalledSite) - The newly created InstalledSite instance. #### Response Example { "instance": "" } ``` -------------------------------- ### SiteInterface - bootApp Method Source: https://api.docs.flarum.org/php/main/Flarum/Foundation/SiteInterface This method is responsible for creating and booting a Flarum application instance. ```APIDOC ## GET /websites/api_flarum_php_main/site/bootApp ### Description Creates and boots a Flarum application instance. ### Method GET ### Endpoint /websites/api_flarum_php_main/site/bootApp ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **AppInterface** (object) - An instance of the booted Flarum application. #### Response Example ```json { "example": "[AppInterface object]" } ``` ``` -------------------------------- ### Get Container Source: https://api.docs.flarum.org/php/main/Flarum/Api/Controller/ShowUserController Gets the service container. ```APIDOC ## GET /container ### Description Gets the service container. ### Method GET ### Endpoint /container ### Parameters None ### Response #### Success Response (200) - **container** (Container) - The service container instance. #### Response Example ```json { "container": "Container object" } ``` ``` -------------------------------- ### FrontendServiceProvider Boot Method Source: https://api.docs.flarum.org/php/main/Flarum/Frontend/FrontendServiceProvider Boots the frontend services, including view factory integration. ```APIDOC ## boot(Container $container, Factory $views) ### Description Boots the frontend services, including view factory integration. ### Method POST ### Endpoint /boot ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **container** (Container) - Required - The container instance. - **views** (Factory) - Required - The view factory instance. ### Request Example ```json { "container": "", "views": "" } ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Constructor for Started Class in PHP Source: https://api.docs.flarum.org/php/main/Flarum/Discussion/Event/Started This snippet details the constructor method for the 'Started' class in PHP. It takes a Discussion object and an optional User object as parameters. The constructor is responsible for initializing the 'Started' object with the provided discussion and actor. ```php class Started { /** * @var Discussion */ protected $discussion; /** * @var User|null */ protected $actor; /** * @param Discussion $discussion * @param User|null $actor */ public function __construct(Discussion $discussion, User $actor = null) { $this->discussion = $discussion; $this->actor = $actor; } } ``` -------------------------------- ### Extend With Source: https://api.docs.flarum.org/php/main/Flarum/Foundation/InstalledSite Applies a list of extenders to the InstalledSite. ```APIDOC ## POST /installedsite/extendwith ### Description Applies a list of extenders to the InstalledSite. ### Method POST ### Endpoint /installedsite/extendwith ### Parameters #### Request Body - **instance** (InstalledSite) - Required - The InstalledSite instance to extend. - **extenders** (array) - Required - An array of extender objects to apply. ### Request Example { "instance": "", "extenders": [ "", "" ] } ### Response #### Success Response (200) - **instance** (InstalledSite) - The modified InstalledSite instance. #### Response Example { "instance": "" } ``` -------------------------------- ### Boot Laravel Source: https://api.docs.flarum.org/php/main/Flarum/Foundation/UninstalledSite Boots the Laravel framework for the application. ```APIDOC ## POST /websites/api_flarum_php_main/UninstalledSite/bootLaravel ### Description Boots the Laravel framework for the application. ### Method POST ### Endpoint /websites/api_flarum_php_main/UninstalledSite/bootLaravel ### Parameters (No parameters) ### Request Example ```json { "example": "No request body needed" } ``` ### Response #### Success Response (200) - **Container** (Container) - The Laravel container instance. #### Response Example ```json { "example": "Container object" } ``` ``` -------------------------------- ### WriteSettings Step Source: https://api.docs.flarum.org/php/main/Flarum/Install/Steps/WriteSettings The WriteSettings step is responsible for writing configuration settings during the Flarum installation. It requires a database connection and accepts custom settings. ```APIDOC ## WriteSettings Step ### Description This step writes configuration settings to the database during Flarum installation. ### Method N/A (This is a class representing a step in a process, not a direct API endpoint) ### Endpoint N/A ### Parameters #### Constructor Parameters - **database** (ConnectionInterface) - Required - The database connection instance. - **custom** (array) - Required - An array of custom settings to be written. ### Request Example N/A (This is a class constructor, not a request body) ### Response #### Success Response N/A (This step performs an action, it does not return a typical API response) #### Response Example N/A ### Methods #### `getMessage()` ##### Description Returns a one-line status message summarizing the current state of this step. ##### Return Value - **string** - A status message. #### `run()` ##### Description Executes the core logic of the WriteSettings step. This method should throw a `StepFailed` exception if the process encounters an error that requires reverting the installation. ##### Return Value - **void** ##### Exceptions - **StepFailed** - Thrown when an error occurs during the settings writing process. ``` -------------------------------- ### Serializer Constructor and Get ID Source: https://api.docs.flarum.org/php/main/Flarum/Api/Serializer/ForumSerializer The constructor for the serializer, accepting configuration and factory dependencies. Also includes a method to get a model's ID. ```PHP public function __construct(Config $config, Factory $filesystemFactory, SettingsRepositoryInterface $settings, UrlGenerator $url) { // Constructor implementation } public function getId($model): string { // Implementation for getting model ID } ``` -------------------------------- ### AbstractCreateController - handle Source: https://api.docs.flarum.org/php/main/Flarum/Api/Controller/CreateDiscussionController Handles incoming server requests and returns a response interface. ```APIDOC ## POST /api/handle ### Description Handles incoming server requests and returns a response interface. ### Method POST ### Endpoint /api/handle ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **ResponseInterface** (object) - The response interface object. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Boot Laravel Source: https://api.docs.flarum.org/php/main/Flarum/Foundation/InstalledSite Boots the Laravel container within the InstalledSite. ```APIDOC ## POST /installedsite/bootlaravel ### Description Boots the Laravel container. ### Method POST ### Endpoint /installedsite/bootlaravel ### Parameters #### Request Body - **instance** (InstalledSite) - Required - The InstalledSite instance. ### Request Example { "instance": "" } ### Response #### Success Response (200) - **container** (Container) - The booted Laravel container. #### Response Example { "container": "" } ``` -------------------------------- ### UninstalledSite Constructor Source: https://api.docs.flarum.org/php/main/Flarum/Foundation/UninstalledSite Initializes a new instance of the UninstalledSite class. ```APIDOC ## POST /websites/api_flarum_php_main/UninstalledSite/__construct ### Description Initializes a new instance of the UninstalledSite class. ### Method POST ### Endpoint /websites/api_flarum_php_main/UninstalledSite/__construct ### Parameters #### Path Parameters - **paths** (Paths) - Required - An instance of the Paths class. - **baseUrl** (string) - Required - The base URL of the site. ### Request Example ```json { "paths": {}, "baseUrl": "http://example.com" } ``` ### Response #### Success Response (200) This method does not return a value directly, but initializes the UninstalledSite object. #### Response Example (No specific response body for initialization) ``` -------------------------------- ### Discussion Creation and Renaming (PHP) Source: https://api.docs.flarum.org/php/main/Flarum/Discussion/Discussion Methods for starting a new discussion and renaming an existing one. start() creates a discussion and raises an event, while rename() updates the title and also raises an event. ```php static Discussion start(string $title, User $user) $this rename(string $title) ``` -------------------------------- ### InstallController Handle Method (PHP) Source: https://api.docs.flarum.org/php/main/Flarum/Install/Controller/InstallController Handles incoming server requests for the installation process. This method is part of the RequestHandlerInterface and is responsible for processing the request and returning a ResponseInterface. ```php public function handle(ServerRequestInterface $request): ResponseInterface { // No description provided for this method. // Actual implementation would go here. return new PsrHttpMessageResponseInterface(); // Placeholder } ``` -------------------------------- ### AbstractSerializeController - getContainer Source: https://api.docs.flarum.org/php/main/Flarum/Api/Controller/CreateAccessTokenController Gets the service container instance. ```APIDOC ## GET /websites/api_flarum_php_main/container ### Description Gets the service container instance. ### Method GET ### Endpoint /websites/api_flarum_php_main/container ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "No request body example available" } ``` ### Response #### Success Response (200) - **Container** - The service container instance. #### Response Example ```json { "example": "No response body example available" } ``` ``` -------------------------------- ### Constructor for AbstractSerializeController Source: https://api.docs.flarum.org/php/main/Flarum/Api/Controller/UploadImageController Initializes the controller with necessary dependencies, including settings and a filesystem factory. These are crucial for the controller's operation. ```php __construct(SettingsRepositoryInterface $settings, Factory $filesystemFactory) ``` -------------------------------- ### PostServiceProvider Registration and Booting in PHP Source: https://api.docs.flarum.org/php/main/Flarum/Post/PostServiceProvider This snippet details the PostServiceProvider in PHP, extending AbstractServiceProvider. It covers its constructor, registration, booting process with a Formatter dependency, and a method for setting post types. The service provider is part of the Flarum framework. ```php class PostServiceProvider extends AbstractServiceProvider { protected Container | $app | from AbstractServiceProvider protected Container | $container | __construct(Container $container) register() boot(Formatter $formatter) protected setPostTypes() } ``` -------------------------------- ### PHP Class: CreateAdminUser Source: https://api.docs.flarum.org/php/main/Flarum/Install/Steps/CreateAdminUser Defines the CreateAdminUser class, implementing the Step interface for Flarum installations. It includes a constructor to set up dependencies and a run method to execute the installation step, with error handling for StepFailed exceptions. ```php class CreateAdminUser implements Step { /** * @var ConnectionInterface */ protected $database; /** * @var AdminUser */ protected $admin; /** * @var string|null */ protected $accessToken; /** * @param ConnectionInterface $database * @param AdminUser $admin * @param string|null $accessToken */ public function __construct(ConnectionInterface $database, AdminUser $admin, string $accessToken = null) { $this->database = $database; $this->admin = $admin; $this->accessToken = $accessToken; } /** * @inheritDoc */ public function getMessage(): string { return 'Creating the administrator user'; } /** * @inheritDoc */ public function run(): void { // Implementation details for running the step would go here. // This method should raise a StepFailed exception whenever something goes wrong // that should result in the entire installation being reverted. } } ``` -------------------------------- ### Construct Image Handler in PHP Source: https://api.docs.flarum.org/php/main/Flarum/Api/Controller/UploadImageController Initializes the image handler with necessary dependencies, including settings and a filesystem factory. ```PHP __construct(SettingsRepositoryInterface $settings, Factory $filesystemFactory) ``` -------------------------------- ### Get Illuminate Config Source: https://api.docs.flarum.org/php/main/Flarum/Foundation/InstalledSite Retrieves the Illuminate configuration repository. ```APIDOC ## GET /installedsite/getilluminateconfig ### Description Retrieves the Illuminate configuration repository. ### Method GET ### Endpoint /installedsite/getilluminateconfig ### Parameters #### Query Parameters - **instance** (InstalledSite) - Required - The InstalledSite instance. ### Request Example GET /installedsite/getilluminateconfig?instance= ### Response #### Success Response (200) - **repository** (Repository) - The Illuminate configuration repository. #### Response Example { "repository": "" } ``` -------------------------------- ### Get ID Source: https://api.docs.flarum.org/php/main/Flarum/Api/Serializer/MailSettingsSerializer Retrieves the unique identifier for a given model. ```APIDOC ## GET /api/websites/api_flarum_php_main/get-id ### Description Returns the unique identifier for a given model instance. ### Method GET ### Endpoint /api/websites/api_flarum_php_main/get-id ### Parameters #### Path Parameters - **model** (mixed) - Required - The model for which to retrieve the ID. #### Query Parameters None #### Request Body None ### Request Example ```json { "message": "This endpoint is conceptual and does not have a direct request body example." } ``` ### Response #### Success Response (200) - **string|int** (string|int) - The unique identifier of the model. #### Response Example ```json { "data": { "id": "model_unique_id" } } ``` ``` -------------------------------- ### StoreConfig Class Documentation Source: https://api.docs.flarum.org/php/main/Flarum/Install/Steps/StoreConfig This section details the StoreConfig class, its constructor, and its methods: getMessage, run, and revert. ```APIDOC ## Class: StoreConfig ### Description Implements the `ReversibleStep` interface for Flarum installation configuration. ### Methods #### `__construct($debugMode, DatabaseConfig $dbConfig, BaseUrl $baseUrl, $configFile)` ##### Parameters - **$debugMode** (mixed) - - **$dbConfig** (DatabaseConfig) - - **$baseUrl** (BaseUrl) - - **$configFile** (mixed) - #### `getMessage()` ##### Description A one-line status message summarizing what's happening in this step. ##### Return Value - **string** - The status message. #### `run()` ##### Description Do the work that constitutes this step. This method should raise a `StepFailed` exception whenever something goes wrong that should result in the entire installation being reverted. ##### Return Value - **void** ##### Exceptions - **StepFailed** #### `revert()` ##### Description Reverts the changes made by this step. ##### Return Value - **void** ### Dependencies - **ReversibleStep**: Flarum\Install\ReversibleStep - **DatabaseConfig**: Flarum\Install\DatabaseConfig - **BaseUrl**: Flarum\Install\BaseUrl - **StepFailed**: Flarum\Install\StepFailed ``` -------------------------------- ### Get Relations to Load Source: https://api.docs.flarum.org/php/main/Flarum/Api/Controller/AbstractCreateController Retrieves the relationships that should be loaded for a collection of models. ```APIDOC ## GET /api/models/relations/load ### Description Returns the relations to load, as defined by extenders, for a given collection of models. ### Method GET ### Endpoint /api/models/relations/load ### Parameters #### Path Parameters None #### Query Parameters - **models** (Collection) - Required - The collection of models for which to determine relations. #### Request Body None ### Request Example ```json { "models": "Collection object" } ``` ### Response #### Success Response (200) - **array** - An array of relationship names to be loaded. #### Response Example ```json { "relations": ["user", "posts"] } ``` ``` -------------------------------- ### Boot Application Service Providers (PHP) Source: https://api.docs.flarum.org/php/main/Flarum/Foundation/Application Initiates the booting process for all registered service providers in the Flarum application. This ensures that services are initialized and ready. ```php void boot() ``` -------------------------------- ### SettingsRepositoryInterface: Get Specific Setting (PHP) Source: https://api.docs.flarum.org/php/main/Flarum/Settings/SettingsRepositoryInterface The `get()` method retrieves a specific setting by its key. It accepts the setting key as a string and an optional default value. If the setting is not found, the default value is returned. The return type is mixed, accommodating various data types for settings. ```PHP interface SettingsRepositoryInterface { public function get($key, $default = null); } ``` -------------------------------- ### Get Assets Filesystem Instance (PHP) Source: https://api.docs.flarum.org/php/main/Flarum/Extension/ExtensionManager Retrieves an instance of the assets filesystem. This method is designed to be resolved dynamically because Flarum's filesystem configuration might not be fully initialized when the ExtensionManager singleton is first created. ```php protected Cloud getAssetsFilesystem() { // Implementation details... } ``` -------------------------------- ### Get Relationship Data Source: https://api.docs.flarum.org/php/main/Flarum/Api/Serializer/MailSettingsSerializer Retrieves data for a specified relationship on a given model. ```APIDOC ## GET /api/websites/api_flarum_php_main/relationship-data ### Description Fetches the data associated with a specific relationship of a model. ### Method GET ### Endpoint /api/websites/api_flarum_php_main/relationship-data ### Parameters #### Path Parameters - **model** (mixed) - Required - The model from which to retrieve relationship data. - **relation** (string) - Required - The name of the relationship. #### Query Parameters None #### Request Body None ### Request Example ```json { "message": "This endpoint is conceptual and does not have a direct request body example." } ``` ### Response #### Success Response (200) - **mixed** (any) - The data of the specified relationship. #### Response Example ```json { "data": [ { "type": "related_resource", "id": "related_id_1" } ] } ``` ``` -------------------------------- ### FrontendServiceProvider Constructor Source: https://api.docs.flarum.org/php/main/Flarum/Frontend/FrontendServiceProvider Initializes the FrontendServiceProvider with a container instance. ```APIDOC ## __construct(Container $container) ### Description Initializes the FrontendServiceProvider with a container instance. ### Method CONSTRUCTOR ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Get Serialized Data Source: https://api.docs.flarum.org/php/main/Flarum/Api/Controller/AbstractCreateController Retrieves data to be serialized and assigned to the response document. ```APIDOC ## GET /api/data ### Description Gets the data that will be serialized and assigned to the response document. This method is used internally for data preparation before serialization. ### Method GET ### Endpoint /api/data ### Parameters #### Path Parameters None #### Query Parameters - **request** (ServerRequestInterface) - Required - The server request object. - **document** (Document) - Required - The document object to which data will be assigned. #### Request Body None ### Request Example ```json { "request": "ServerRequestInterface object", "document": "Document object" } ``` ### Response #### Success Response (200) - **mixed** - The data to be serialized. #### Response Example ```json { "data": "serialized data" } ``` ``` -------------------------------- ### Controller Constructor and Image Creation Source: https://api.docs.flarum.org/php/main/Flarum/Api/Controller/UploadImageController Documentation for the constructor of a controller and the `makeImage` method. ```APIDOC ## Controller Utilities ### Description Provides details on controller instantiation and image creation from uploaded files. ### Methods #### `__construct(SettingsRepositoryInterface $settings, Factory $filesystemFactory)` ##### Description Constructor for the controller, injecting settings and filesystem factory. ##### Parameters - **$settings** (SettingsRepositoryInterface) - The settings repository. - **$filesystemFactory** (Factory) - The filesystem factory. ### `makeImage(UploadedFileInterface $file)` ##### Description Creates an `Image` object from an uploaded file. ##### Parameters - **$file** (UploadedFileInterface) - The uploaded file. ##### Return Value - **Image** - The created Image object. ``` -------------------------------- ### PostCreationThrottler Source: https://api.docs.flarum.org/php/main/Flarum/Post/PostCreationThrottler Documentation for the PostCreationThrottler class, including its properties and the __invoke method. ```APIDOC ## PostCreationThrottler ### Description Handles rate limiting for post creation. ### Properties - **$timeout** (mixed) - Timeout property for throttling. ### Methods #### __invoke(ServerRequestInterface $request) ##### Description Checks if a request should be throttled for post creation. ##### Method POST (Implied by throttling logic) ##### Endpoint /throttle/post-creation ##### Parameters ###### Path Parameters None ###### Query Parameters None ###### Request Body None (Method operates on the request object itself) ### Request Example None (Method operates on the request object itself) ### Response #### Success Response (200) - **bool|void** - Indicates whether the request was allowed or throttled. #### Response Example ```json { "throttled": true } ``` #### Error Response (429) - **message** (string) - "Too Many Requests" #### Error Response Example ```json { "message": "Too Many Requests" } ``` -------------------------------- ### FilesystemManager Get Driver Source: https://api.docs.flarum.org/php/main/Flarum/Filesystem/FilesystemManager Retrieves the driver instance for a given filesystem disk name. ```APIDOC ## GET /filesystem/manager/getDriver ### Description Retrieves the driver instance for a given filesystem disk name. ### Method GET ### Endpoint /filesystem/manager/getDriver ### Parameters #### Query Parameters - **name** (string) - Required - The name of the filesystem disk. ### Request Example ```json { "name": "local" } ``` ### Response #### Success Response (200) - **driver** (string|DriverInterface) - The driver instance or its name. #### Response Example ```json { "driver": "local" } ``` ``` -------------------------------- ### Get Relation Callables to Load Source: https://api.docs.flarum.org/php/main/Flarum/Api/Controller/AbstractCreateController Retrieves the relation callables that should be loaded for a collection of models. ```APIDOC ## GET /api/models/relations/callables ### Description Returns the relation callables to load, as defined by extenders, for a given collection of models. ### Method GET ### Endpoint /api/models/relations/callables ### Parameters #### Path Parameters None #### Query Parameters - **models** (Collection) - Required - The collection of models for which to determine relation callables. #### Request Body None ### Request Example ```json { "models": "Collection object" } ``` ### Response #### Success Response (200) - **array** - An array of relation callable definitions. #### Response Example ```json { "relation_callables": [ { "name": "author", "callback": "..." } ] } ``` ``` -------------------------------- ### FilesystemServiceProvider Registration in PHP Source: https://api.docs.flarum.org/php/main/Flarum/Filesystem/FilesystemServiceProvider Documentation for the FilesystemServiceProvider class in PHP, extending AbstractServiceProvider. It details the constructor and the register method, which is crucial for service container setup. ```php class FilesystemServiceProvider extends AbstractServiceProvider { /** * @inheritdoc */ public function register() { // Implementation details for registering filesystem services } /** * @param Container $container */ public function __construct(Container $container) { // Constructor implementation } } ``` -------------------------------- ### FilesystemManager Get Local Config Source: https://api.docs.flarum.org/php/main/Flarum/Filesystem/FilesystemManager Retrieves the local configuration for a specified filesystem disk name. ```APIDOC ## GET /filesystem/manager/getLocalConfig ### Description Retrieves the local configuration for a specified filesystem disk name. ### Method GET ### Endpoint /filesystem/manager/getLocalConfig ### Parameters #### Query Parameters - **name** (string) - Required - The name of the filesystem disk. ### Request Example ```json { "name": "local" } ``` ### Response #### Success Response (200) - **config** (array) - The local configuration array for the specified disk. #### Response Example ```json { "config": { "driver": "local", "root": "storage/app" } } ``` ``` -------------------------------- ### Server API Source: https://api.docs.flarum.org/php/main/Flarum/Console/Server Documentation for the Server class, including its constructor and listen method. ```APIDOC ## Server API ### Description Documentation for the Server class, including its constructor and listen method. ### Methods #### `__construct(SiteInterface $site)` ##### Description No description ##### Method CONSTRUCT ##### Parameters * **$site** (SiteInterface) - Required - The site interface instance. #### `listen()` ##### Description No description ##### Method GET ##### Endpoint /listen ##### Response #### Success Response (200) No description provided for the success response. #### Response Example ```json { "message": "Server is listening" } ``` ``` -------------------------------- ### API - Get Container Source: https://api.docs.flarum.org/php/main/Flarum/Api/Controller/ListDiscussionsController Retrieves the service container instance. ```APIDOC ## GET /api/container ### Description Retrieves the global service container instance. This can be used to access various services within the Flarum application. ### Method GET ### Endpoint /api/container ### Parameters None ### Request Example (No request body) ### Response #### Success Response (200) - **Container** - The service container instance. #### Response Example ```json { "container": "" } ``` ``` -------------------------------- ### Get Relations to Load Source: https://api.docs.flarum.org/php/main/Flarum/Api/Controller/ShowUserController Returns the relations to load, added by extenders. ```APIDOC ## GET /relations/to-load ### Description Returns the relations to load added by extenders. ### Method GET ### Endpoint /relations/to-load ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **models** (Collection) - Required - The collection of models. ### Request Example ```json { "models": "Collection object" } ``` ### Response #### Success Response (200) - **relations** (array) - An array of relations to load. #### Response Example ```json { "relations": ["relation1", "relation2"] } ``` ``` -------------------------------- ### Get Data Source: https://api.docs.flarum.org/php/main/Flarum/Api/Controller/ShowUserController Retrieves data to be serialized and assigned to the response document. ```APIDOC ## POST /data ### Description Get the data to be serialized and assigned to the response document. ### Method POST ### Endpoint /data ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **request** (ServerRequestInterface) - Required - The server request object. - **document** (Document) - Required - The document object to which data will be assigned. ### Request Example ```json { "request": "ServerRequestInterface object", "document": "Document object" } ``` ### Response #### Success Response (200) - **data** (mixed) - The data to be serialized. #### Response Example ```json { "data": "serialized data" } ``` ``` -------------------------------- ### Constructor - AbstractShowController (PHP) Source: https://api.docs.flarum.org/php/main/Flarum/Api/Controller/ShowUserController Initializes the AbstractShowController with a SlugManager and a UserRepository. These dependencies are crucial for handling slugs and user data within the controller. ```php __construct(SlugManager $slugManager, UserRepository $users) ``` -------------------------------- ### API - Get Relations to Load Source: https://api.docs.flarum.org/php/main/Flarum/Api/Controller/ListDiscussionsController Returns the relations to load for a collection of models. ```APIDOC ## GET /api/relations/load ### Description Returns the relations to load for a collection of models, as defined by extenders. This helps in optimizing data fetching by specifying which relationships should be eager-loaded. ### Method GET ### Endpoint /api/relations/load ### Parameters #### Path Parameters None #### Query Parameters - **models** (Collection) - Required - The collection of models for which to determine relations to load. #### Request Body None ### Request Example ```json { "models": "" } ``` ### Response #### Success Response (200) - **array** - An array of relations to be loaded. #### Response Example ```json { "relations": ["user", "comments"] } ``` ``` -------------------------------- ### Fire Application Booting Callbacks (PHP) Source: https://api.docs.flarum.org/php/main/Flarum/Foundation/Application Executes all registered callbacks for the application's booting phase. This method ensures that any custom booting logic is triggered. ```php protected void fireAppCallbacks(array $callbacks) ``` -------------------------------- ### API - Get Data Source: https://api.docs.flarum.org/php/main/Flarum/Api/Controller/ListDiscussionsController Retrieves data to be serialized and assigned to the response document. ```APIDOC ## GET /api/data ### Description Gets the data to be serialized and assigned to the response document. This method is used internally to prepare data for API responses. ### Method GET ### Endpoint /api/data ### Parameters #### Path Parameters None #### Query Parameters - **request** (ServerRequestInterface) - Required - The server request object. - **document** (Document) - Required - The document object to which the data will be assigned. #### Request Body None ### Request Example ```json { "request": "", "document": "" } ``` ### Response #### Success Response (200) - **mixed** - The data to be serialized. #### Response Example ```json { "data": "" } ``` ``` -------------------------------- ### BasicPostSerializer Class Definition (PHP) Source: https://api.docs.flarum.org/php/main/Flarum/Api/Serializer/BasicPostSerializer Defines the BasicPostSerializer class, which extends AbstractSerializer. It includes properties for request, actor, container, attribute mutators, custom relations, logging, translation, and type. It also defines methods for getting and setting requests, retrieving the actor, getting attributes, handling default attributes, formatting dates, and managing relationships. ```php class **BasicPostSerializer** extends AbstractSerializer ## Properties protected ServerRequestInterface | $request | | from AbstractSerializer | protected User | $actor | | from AbstractSerializer | static protected Container | $container | | from AbstractSerializer | static protected array | $attributeMutators | | from AbstractSerializer | static protected array> | $customRelations | | from AbstractSerializer | protected LogReporter | $log | | | protected TranslatorInterface | $translator | | | protected | $type |

{@inheritdoc}

| | ## Methods ServerRequestInterface getRequest() No description from AbstractSerializer setRequest(ServerRequestInterface $request) No description from AbstractSerializer User getActor() No description from AbstractSerializer getAttributes($model, array $fields = null)

{@inheritdoc}

from AbstractSerializer array defaultAttributes(Post $post)

Get the default set of serialized attributes for a model.

string|null formatDate(DateTime $date = null) No description from AbstractSerializer getRelationship($model, $name)

{@inheritdoc}

from AbstractSerializer Relationship|null getCustomRelationship(mixed $model, string $name)

Get a custom relationship.

from AbstractSerializer Relationship hasOne(mixed $model, string|Closure|SerializerInterface $serializer, string|Closure|null $relation = null)

Get a relationship builder for a has-one relationship.

from AbstractSerializer Relationship hasMany(mixed $model, string|Closure|SerializerInterface $serializer, string|null $relation = null)

Get a relationship builder for a has-many relationship.

from AbstractSerializer Relationship|null buildRelationship(mixed $model, string|Closure|SerializerInterface $serializer, string|null $relation = null, bool $many = false) No description from AbstractSerializer mixed getRelationshipData(mixed $model, string $relation) No description from AbstractSerializer SerializerInterface resolveSerializer(mixed $serializer, mixed $model, mixed $data) No description from AbstractSerializer object resolveSerializerClass(string $class) No description from AbstractSerializer static Container getContainer() No description from AbstractSerializer static setContainer(Container $container) No description from AbstractSerializer static void addAttributeMutator(string $serializerClass, callable $callback) No description from AbstractSerializer static void setRelationship(string $serializerClass, string $relation, callable $callback) No description from AbstractSerializer __construct(LogReporter $log, TranslatorInterface $translator) No description Relationship user($post) No description Relationship discussion($post) No description ``` -------------------------------- ### FilesystemManager Constructor Source: https://api.docs.flarum.org/php/main/Flarum/Filesystem/FilesystemManager Initializes the FilesystemManager with the application container, local disk configurations, and driver definitions. ```APIDOC ## POST /filesystem/manager/__construct ### Description Initializes the FilesystemManager with the application container, local disk configurations, and driver definitions. ### Method POST ### Endpoint /filesystem/manager/__construct ### Parameters #### Request Body - **app** (Container) - Required - The application container instance. - **diskLocalConfig** (array) - Required - An array of local disk configurations. - **drivers** (array) - Required - An array defining the filesystem drivers. ### Request Example ```json { "app": "", "diskLocalConfig": {}, "drivers": {} } ``` ### Response #### Success Response (200) This method does not return a value directly, but initializes the object. #### Response Example (No direct response body for constructor initialization) ``` -------------------------------- ### Constructor - AbstractShowController (PHP) Source: https://api.docs.flarum.org/php/main/Flarum/Api/Controller/ShowGroupController The constructor for `AbstractShowController`. It initializes the controller with a `GroupRepository` instance, which is used for fetching group-related data. This dependency is crucial for controllers that need to interact with group information. ```php __construct(GroupRepository $groups) ``` -------------------------------- ### Get Container (PHP) Source: https://api.docs.flarum.org/php/main/Flarum/Api/Serializer/BasicDiscussionSerializer A static method to retrieve the application's container instance. ```php static protected function getContainer(): Container ``` -------------------------------- ### AbstractShowController - createElement Source: https://api.docs.flarum.org/php/main/Flarum/Api/Controller/CreateDiscussionController Creates a PHP JSON-API Element for output in the document. ```APIDOC ## POST /api/elements ### Description Creates a PHP JSON-API Element for output in the document. ### Method POST ### Endpoint /api/elements ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **data** (mixed) - The data to create the element from. - **serializer** (SerializerInterface) - The serializer to use for creating the element. ### Request Example ```json { "data": "mixed data", "serializer": "SerializerInterface object" } ``` ### Response #### Success Response (200) - **ElementInterface** (object) - The created JSON-API Element. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Container Management API Source: https://api.docs.flarum.org/php/main/Flarum/Api/Controller/AbstractSerializeController Provides methods to get and set the service container instance. ```APIDOC ## GET /api/container ### Description Retrieves the current service container instance. ### Method GET ### Endpoint /api/container ### Parameters None ### Request Example None ### Response #### Success Response (200) - **container** (object) - The service container instance. #### Response Example ```json { "container": {} } ``` ## PUT /api/container ### Description Sets the service container instance. ### Method PUT ### Endpoint /api/container ### Parameters #### Request Body - **container** (object) - The container instance to set. ### Request Example ```json { "container": {} } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message. #### Response Example ```json { "message": "Container set successfully." } ``` ``` -------------------------------- ### Constructor - AbstractShowController (PHP) Source: https://api.docs.flarum.org/php/main/Flarum/Api/Controller/ShowPostController Initializes the AbstractShowController with a PostRepository dependency. This repository is used to fetch and manage post data for the controller. ```php __construct(PostRepository $posts) ``` -------------------------------- ### Get User Login Providers (PHP) Source: https://api.docs.flarum.org/php/main/Flarum/User/Guest Retrieves the login providers configured for the user. This method returns a collection of provider identifiers. ```php public function loginProviders() { return $this->hasMany(LoginProvider::class); } ``` -------------------------------- ### Get Visible Groups (PHP) Source: https://api.docs.flarum.org/php/main/Flarum/User/Guest Retrieves the groups that are visible to the user. The specific implementation and return type are not detailed in the provided snippet. ```php visibleGroups() ``` -------------------------------- ### Initialize Database from Schema Source: https://api.docs.flarum.org/php/main/Flarum/Database/Migrator Initializes the Flarum database from a schema dump file. ```APIDOC ## POST /websites/api_flarum_php_main/installFromSchema ### Description Initialize the Flarum database from a schema dump. ### Method POST ### Endpoint /websites/api_flarum_php_main/installFromSchema ### Parameters #### Path Parameters - **path** (string) - Required - The path to the directory containing the schema dump file. ### Request Body (This endpoint does not explicitly define a request body in the provided documentation, but parameters are passed as arguments) ### Response #### Success Response (200) (No specific success response details provided in the documentation) #### Response Example (No example provided) ```