### Get Installation Status Indicator
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/placeholder-service.md
Retrieves the installation status. Currently returns 'NOTINSTALLED' as a placeholder.
```php
public function installed(): string
```
```php
$status = $service->installed();
```
--------------------------------
### UiAlert Examples
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/ui-components.md
Demonstrates the usage of the UiAlert component for displaying informational, warning, and danger messages. Ensure the '@blueprint/ui' package is installed.
```tsx
import { UiAlert } from '@blueprint/ui';
export default function MyComponent() {
return (
<>
This is an informational message
Warning: This action cannot be undone
Error: Configuration is invalid
>
);
}
```
--------------------------------
### installed()
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/placeholder-service.md
Retrieves the installation status indicator. Currently returns 'NOTINSTALLED' as a placeholder.
```APIDOC
## installed()
### Description
Get the installation status indicator.
### Method
```php
public function installed(): string
```
### Returns
String indicating installation status. Currently returns 'NOTINSTALLED' as a placeholder.
### Example
```php
$status = $service->installed();
```
```
--------------------------------
### Get Configurations for All Installed Extensions
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/blueprint-base-library.md
Retrieves configurations for all installed extensions, returned as a Laravel Collection. Allows for easy manipulation and iteration over multiple configurations.
```php
public function extensionsConfigs(): Collection
```
```php
$allConfigs = $blueprint->extensionsConfigs();
$allConfigs->each(function ($config) {
echo $config['info']['name'] . ": " . $config['info']['version'] . "\n";
});
```
--------------------------------
### Get a List of All Installed Extensions
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/blueprint-base-library.md
Retrieves an array containing the identifiers of all extensions that are currently installed. Useful for iterating through available extensions.
```php
public function extensions(): array
```
```php
$allExtensions = $blueprint->extensions();
foreach ($allExtensions as $identifier) {
echo "Extension: $identifier\n";
}
```
--------------------------------
### Check Extension Installation
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/README.md
Check if another extension is installed and available for integration.
```php
if ($blueprint->extension('other-extension')) {
// Integrate with other-extension
}
```
--------------------------------
### Blueprint Extension Configuration Keys
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/configuration.md
Examples of configuration keys specific to installed extensions. These keys are used to store settings for individual extensions within the Blueprint framework.
```text
blueprint::extensionconfig_{identifier}_eggs
blueprint::extensionconfig_{identifier}_adminlayouts
blueprint::extensionconfig_{identifier}_dashboardwrapper
```
--------------------------------
### Get Application Base Path
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/placeholder-service.md
Retrieves the absolute path to the panel's root installation directory.
```php
public function folder(): string
```
```php
$basePath = $service->folder();
// Returns something like: /var/www/pterodactyl
echo "Panel installed at: $basePath";
```
--------------------------------
### Client-Side Example: Fetching Egg IDs
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/extension-route-controller.md
This TypeScript example demonstrates how a client-side application can fetch the list of egg IDs for a given extension using the API. It includes basic error handling and logging.
```typescript
// Client-side TypeScript/JavaScript
const response = await fetch('/api/client/extensions/blueprint/eggs?id=myext');
const eggIds = await response.json();
console.log('Eggs for myext:', eggIds);
```
--------------------------------
### UiBadge Examples
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/ui-components.md
Shows how to use the UiBadge component for displaying labels or status information. It accepts standard HTML attributes and can be styled with additional Tailwind classes. Ensure the '@blueprint/ui' package is installed.
```tsx
import { UiBadge } from '@blueprint/ui';
export default function StatusDisplay() {
return (
);
}
```
--------------------------------
### Client API Route Definition
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/README.md
Define client-side API endpoints for an extension by creating a PHP file in `routes/blueprint/client/`. This example shows how to define GET and POST routes for data.
```php
extension('other-extension')) {
// Integrate with other-extension
}
```
```
--------------------------------
### Metadata Structure Example
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/extension-cached-metadata.md
Illustrates the expected structure of the 'metadata' field, which is a JSON array containing at least 'latest_version' and 'local_version'.
```json
[
'latest_version' => '1.2.3', // Latest version string
'local_version' => '1.2.0', // Currently installed version
// Additional fields may be added in future versions
]
```
--------------------------------
### extensionConfig
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/blueprint-base-library.md
Fetches the configuration details for a specific extension. Returns null if the extension is not installed.
```APIDOC
## extensionConfig
### Description
Retrieve the configuration for a specific extension. Returns null if extension is not installed.
### Method
`public function extensionConfig(string $identifier): ?array`
### Parameters
#### Path Parameters
- **identifier** (string) - Required - Extension identifier
### Response
#### Success Response (?array)
- Configuration array or null if extension not found.
### Example
```php
$config = $blueprint->extensionConfig('myext');
if ($config) {
$version = $config['info']['version'] ?? 'unknown';
echo "Version: $version";
}
```
```
--------------------------------
### Check if an Extension is Installed
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/blueprint-base-library.md
Verifies if an extension is currently installed on the system using its unique identifier. Useful for conditional logic.
```php
public function extension(string $identifier): bool
```
```php
if ($blueprint->extension('advanced-analytics')) {
// Use advanced-analytics extension features
}
```
--------------------------------
### Get Extension Configuration
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/README.md
Retrieve the configuration details for a specific extension. The version can be accessed from the 'info' key.
```php
$config = $blueprint->extensionConfig('myext');
if ($config) {
$version = $config['info']['version'];
}
```
--------------------------------
### Retrieve Configuration for a Specific Extension
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/blueprint-base-library.md
Fetches the configuration settings for a given extension identifier. Returns null if the extension is not installed. Configuration is returned as an array.
```php
public function extensionConfig(string $identifier): ?array
```
```php
$config = $blueprint->extensionConfig('myext');
if ($config) {
$version = $config['info']['version'] ?? 'unknown';
echo "Version: $version";
}
```
--------------------------------
### Scheduled Task Example
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/blueprint-console-library.md
Shows how to define a scheduled task for an extension that automatically runs an Artisan command. Place this file in `app/BlueprintFramework/Schedules/`.
```php
command('myext:process')
->everyFiveMinutes()
->withoutOverlapping();
};
```
--------------------------------
### List Extensions
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/routes.md
Retrieves a list of all installed extensions available in the admin panel.
```APIDOC
## GET /admin/extensions
### Description
Lists all extensions in the admin panel.
### Method
GET
### Endpoint
/admin/extensions
### Parameters
#### Query Parameters
None
### Response
#### Success Response (200)
- extensions (array) - A list of extension objects.
```
--------------------------------
### Querying Metadata
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/extension-cached-metadata.md
Provides examples for querying cached metadata to find extensions with available updates or all installed extensions.
```APIDOC
## Querying Metadata
### Description
Provides examples for querying cached metadata to find extensions with available updates or all installed extensions.
### Usage
#### Find extensions with available updates
```php
// Find extensions with available updates
$extensionsWithUpdates = ExtensionCachedMetadata::get()
->filter(function ($record) {
return version_compare(
$record->metadata['latest_version'] ?? '0',
$record->metadata['local_version'] ?? '0',
'>'
);
});
```
#### Get all extensions installed in system
```php
// Get all extensions installed in system
$allExtensions = ExtensionCachedMetadata::whereIn(
'identifier',
$blueprint->extensions() // from BlueprintBaseLibrary
)->get();
```
```
--------------------------------
### Extension Management and Configuration Access
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/README.md
Check if an extension is installed using `extension` and retrieve its configuration using `extensionConfig`. Iterate through all installed extensions using the `extensions` method.
```php
if ($blueprint->extension('advanced-analytics')) {
$config = $blueprint->extensionConfig('advanced-analytics');
}
foreach ($blueprint->extensions() as $identifier) {
// Work with each extension
}
```
--------------------------------
### Artisan Command Example
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/blueprint-console-library.md
Demonstrates how to use BlueprintConsoleLibrary within a Laravel Artisan command to fetch and set data. Ensure the BlueprintConsoleLibrary is injected into the command's constructor.
```php
namespace Pterodactyl\Console\Commands\BlueprintFramework;
use Illuminate\Console\Command;
use Pterodactyl\BlueprintFramework\Libraries\ExtensionLibrary\Console\BlueprintConsoleLibrary;
class MyCommand extends Command
{
protected $signature = 'myext:process';
protected $description = 'Process extension data';
public function __construct(
private BlueprintConsoleLibrary $blueprint,
) {
parent::__construct();
}
public function handle()
{
// Get configuration
$config = $this->blueprint->dbGet('myext', 'config');
$this->info("Current config: " . json_encode($config));
// Update processing state
$this->blueprint->dbSet('myext', 'last_run', now()->timestamp);
$this->info('Command completed successfully');
}
}
```
--------------------------------
### Query All Installed Extensions
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/extension-cached-metadata.md
Retrieves all cached metadata records for extensions that are currently installed in the system, using the 'identifier' field.
```php
// Get all extensions installed in system
$allExtensions = ExtensionCachedMetadata::whereIn(
'identifier',
$blueprint->extensions() // from BlueprintBaseLibrary
)->get();
```
--------------------------------
### Get Extension Configuration
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/README.md
Retrieves the configuration details for a specific extension.
```APIDOC
## Get Extension Configuration
### Description
Retrieves the configuration array for a specified extension.
### Method
PHP Function Call
### Parameters
#### `extensionConfig(string $extensionName)`
- **extensionName** (string) - The name of the extension whose configuration is to be retrieved.
### Request Example
```php
$config = $blueprint->extensionConfig('myext');
if ($config) {
$version = $config['info']['version'];
}
```
```
--------------------------------
### folder()
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/placeholder-service.md
Retrieves the absolute path to the application's base directory (root installation path).
```APIDOC
## folder()
### Description
Get the application's base path (root directory).
### Method
```php
public function folder(): string
```
### Returns
Absolute path to the panel installation directory.
### Example
```php
$basePath = $service->folder();
// Returns something like: /var/www/pterodactyl
echo "Panel installed at: $basePath";
```
```
--------------------------------
### extension
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/blueprint-base-library.md
Checks if an extension is installed by its unique identifier.
```APIDOC
## extension
### Description
Check if an extension is installed by its identifier.
### Method
`public function extension(string $identifier): bool`
### Parameters
#### Path Parameters
- **identifier** (string) - Required - Extension identifier (e.g., 'myext')
### Response
#### Success Response (bool)
- Boolean indicating whether the extension is installed.
### Example
```php
if ($blueprint->extension('advanced-analytics')) {
// Use advanced-analytics extension features
}
```
```
--------------------------------
### extensionsConfigs
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/blueprint-base-library.md
Obtains configurations for all installed extensions, returned as a Laravel Collection.
```APIDOC
## extensionsConfigs
### Description
Get configurations for all installed extensions as a Laravel Collection.
### Method
`public function extensionsConfigs(): Collection`
### Response
#### Success Response (Collection)
- Illuminate\Support\Collection containing configuration arrays for each installed extension.
### Example
```php
$allConfigs = $blueprint->extensionsConfigs();
$allConfigs->each(function ($config) {
echo $config['info']['name'] . ": " . $config['info']['version'] . "\n";
});
```
```
--------------------------------
### Extension Configuration Update Request
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/routes.md
Example JSON payload for updating a specific extension's configuration.
```json
{
"_identifier": "myext",
"myext_eggs": ["-1"],
"myext_adminlayouts": true,
"myext_dashboardwrapper": false
}
```
--------------------------------
### Retrieve and Set Settings
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/configuration.md
Access and modify configuration settings programmatically using the `SettingsRepositoryInterface`. Provides methods for getting single settings, getting settings with a default value, and setting new values.
```php
use Pterodactyl\Contracts\Repository\SettingsRepositoryInterface;
public function someMethod(SettingsRepositoryInterface $settings)
{
// Get single setting
$value = $settings->get('blueprint::flags:remote_metadata');
// Get with default
$value = $settings->get('blueprint::cache', 0);
// Set setting
$settings->set('blueprint::key', 'value');
}
```
--------------------------------
### extensions
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/blueprint-base-library.md
Retrieves a list of all installed extension identifiers.
```APIDOC
## extensions
### Description
Get a list of all installed extensions.
### Method
`public function extensions(): array`
### Response
#### Success Response (array)
- Array of extension identifiers (strings).
### Example
```php
$allExtensions = $blueprint->extensions();
foreach ($allExtensions as $identifier) {
echo "Extension: $identifier\n";
}
```
```
--------------------------------
### Admin Controller for Extension Configuration
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/README.md
An example of an admin controller that saves extension configuration to the database using `dbSet` and provides user feedback with an alert. It expects validated request data.
```php
namespace Pterodactyl\Http\Controllers\Admin\Extensions\MyExt;
use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\BlueprintFramework\Libraries\ExtensionLibrary\Admin\BlueprintAdminLibrary;
use Illuminate\Http\Request;
class MyExtExtensionController extends Controller
{
public function __construct(
private BlueprintAdminLibrary $blueprint,
) {}
public function update(Request $request)
{
$this->blueprint->dbSet('myext', 'config', $request->validated());
$this->blueprint->alert('success', 'Configuration saved');
return back();
}
}
```
--------------------------------
### GET /api/client/extensions/blueprint/eggs Route
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/routes.md
This snippet shows a GET route for retrieving egg IDs configured for an extension. The 'id' query parameter can specify a particular extension.
```text
Route: GET /api/client/extensions/blueprint/eggs
Controller: Pterodactyl\BlueprintFramework\Controllers\ExtensionRouteController@eggs
```
--------------------------------
### Get Configured Eggs
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/README.md
Retrieves a list of configured eggs for the Blueprint extension, identified by an ID.
```APIDOC
## Get Configured Eggs
### Description
Retrieves a list of configured eggs associated with the Blueprint extension, identified by a specific ID.
### Method
GET
### Endpoint
`/api/client/extensions/blueprint/eggs`
### Parameters
#### Query Parameters
- **id** (string) - The identifier to filter the eggs.
### Request Example
`/api/client/extensions/blueprint/eggs?id={identifier}`
### Response
#### Success Response (200)
- **eggs** (array) - A list of configured egg objects.
#### Response Example
(Example response structure not provided in source)
```
--------------------------------
### Cache Busting in Asset Imports
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/configuration.md
Example of how asset imports include the cache version for cache busting.
```html
```
--------------------------------
### Blueprint Framework Settings Update Request
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/routes.md
Example JSON payload for updating Blueprint framework settings.
```json
{
"flags:remote_metadata": true,
"flags:feature_x": false
}
```
--------------------------------
### Access Extension Configuration with Blueprint Admin Library (PHP)
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/extension-configuration-controller.md
Utilize the BlueprintAdminLibrary in PHP to get the entire extension configuration object or specific database entries for your extension.
```php
use Pterodactyl\BlueprintFramework\Libraries\ExtensionLibrary\Admin\BlueprintAdminLibrary;
public function view(BlueprintAdminLibrary $blueprint)
{
// Get extension configuration
$config = $blueprint->extensionConfig('myext');
$info = $config['info'] ?? [];
$customData = $blueprint->dbGet('myext', 'custom_key');
}
```
--------------------------------
### Dynamic Extension Routes Pattern
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/routes.md
Defines the pattern for dynamically created routes for each installed extension, including various HTTP methods and controller mapping.
```text
Route: GET /admin/extensions/{identifier}
Route: PATCH /admin/extensions/{identifier}
Route: POST /admin/extensions/{identifier}
Route: PUT /admin/extensions/{identifier}
Route: DELETE /admin/extensions/{identifier}/{target}/{id}
Controller Pattern: Pterodactyl\Http\Controllers\Admin\Extensions\{identifier}\{identifier}ExtensionController@{method}
Route Names:
- admin.extensions.{identifier}.index
- admin.extensions.{identifier}.patch
- admin.extensions.{identifier}.post
- admin.extensions.{identifier}.put
- admin.extensions.{identifier}.delete
```
--------------------------------
### Get Blueprint Framework Version
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/placeholder-service.md
Retrieves the current version of the Blueprint framework. Returns 'unknown' if the version is not set.
```php
public function version(): string
```
```php
$service = app(BlueprintPlaceholderService::class);
$version = $service->version();
echo "Blueprint version: $version";
```
--------------------------------
### Example Response: Egg IDs
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/extension-route-controller.md
This JSON represents the expected response format when querying for extension egg IDs. It is an array of strings or integers.
```json
["-1", "1", "5", "12"]
```
--------------------------------
### Custom Command in Extension
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/console-commands.md
Example of creating a custom console command within an extension. This command processes data, with logic to prevent frequent runs unless forced.
```php
namespace Pterodactyl\Console\Commands\BlueprintFramework;
use Illuminate\Console\Command;
use Pterodactyl\BlueprintFramework\Libraries\ExtensionLibrary\Console\BlueprintConsoleLibrary;
class MyExtCommand extends Command
{
protected $signature = 'myext:process {--force}';
protected $description = 'Process myext data';
public function __construct(
private BlueprintConsoleLibrary $blueprint,
)
{
parent::__construct();
}
public function handle()
{
$force = $this->option('force');
$lastRun = $this->blueprint->dbGet('myext', 'last_run', 0);
if (!$force && (time() - $lastRun) < 300) {
$this->info('Command ran recently, skipping');
return 0;
}
$this->info('Processing...');
$this->blueprint->dbSet('myext', 'last_run', time());
return 0;
}
}
```
--------------------------------
### Cache Busting Example
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/console-commands.md
Illustrates how the cache-busting parameter in stylesheet imports changes after running the bp:cache command. The 'v' parameter is updated with a new Unix timestamp.
```html
```
```html
```
--------------------------------
### PHP Controller Example: Displaying Settings
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/blueprint-extension-controller.md
This PHP controller code demonstrates how to retrieve a boolean setting for remote metadata fetching from the settings repository and pass it to a Blade view.
```php
namespace Pterodactyl\Http\Controllers\Admin\Extensions;
use Illuminate\View\View;
use Pterodactyl\Contracts\Repository\SettingsRepositoryInterface;
class BlueprintSettingsController extends Controller
{
public function __construct(
private SettingsRepositoryInterface $settings,
) {}
public function index(): View
{
// Get current settings
$remoteMetadata = (bool) $this->settings->get('blueprint::flags:remote_metadata');
return view('admin.extensions.blueprint.settings', [
'remoteMetadata' => $remoteMetadata,
]);
}
}
```
--------------------------------
### Dynamic Extension Routes
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/routes.md
Provides a set of dynamic routes for interacting with specific installed extensions. These routes are generated based on the extension's identifier.
```APIDOC
## Dynamic Extension Routes
### Description
For each installed extension, dynamic routes are created to interact with it via its unique identifier.
### Method
GET, PATCH, POST, PUT, DELETE
### Endpoint
- GET /admin/extensions/{identifier}
- PATCH /admin/extensions/{identifier}
- POST /admin/extensions/{identifier}
- PUT /admin/extensions/{identifier}
- DELETE /admin/extensions/{identifier}/{target}/{id}
### Parameters
#### Path Parameters
- identifier (string) - Required - The unique identifier of the extension.
- target (string) - Required (for DELETE) - The target resource within the extension.
- id (string) - Required (for DELETE) - The ID of the specific resource to delete.
### Response
#### Success Response (200)
- Varies based on the specific extension and action performed.
```
--------------------------------
### Admin Extension Controller Usage
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/blueprint-admin-library.md
Example of using BlueprintAdminLibrary within an admin extension controller to display alerts and handle configuration updates. Ensure BlueprintAdminLibrary is injected into the controller.
```php
namespace Pterodactyl\Http\Controllers\Admin\Extensions\MyExt;
use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\BlueprintFramework\Libraries\ExtensionLibrary\Admin\BlueprintAdminLibrary;
class MyExtensionController extends Controller
{
public function __construct(
private BlueprintAdminLibrary $blueprint,
) {}
public function update(Request $request)
{
// Process configuration
if ($validationFails) {
$this->blueprint->alert('danger', 'Invalid configuration');
return back();
}
// Save configuration
$this->blueprint->alert('success', 'Configuration saved successfully');
return redirect()->route('admin.extensions.myext.index');
}
}
```
--------------------------------
### Run Metadata Refresh Command
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/console-commands.md
Execute the bp:meta command to refresh cached metadata for installed extensions. This requires the 'remote_metadata' flag to be enabled and network access to the Blueprint API.
```bash
php artisan bp:meta
```
--------------------------------
### Get Extension Configuration in PHP (Server-side)
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/extension-configuration-controller.md
Retrieve extension configuration values like eggs and feature flags using the SettingsRepositoryInterface in your PHP controllers.
```php
use Pterodactyl\Contracts\Repository\SettingsRepositoryInterface;
public function someController(SettingsRepositoryInterface $settings)
{
// Get eggs configuration
$eggsJson = $settings->get('blueprint::extensionconfig_myext_eggs');
$eggs = json_decode($eggsJson);
// Get feature flags
$adminLayouts = (bool) $settings->get('blueprint::extensionconfig_myext_adminlayouts');
}
```
--------------------------------
### Blueprint Database Setting Keys
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/configuration.md
These are examples of keys used to store configuration settings within the Laravel 'settings' table for the Blueprint framework. They follow a specific naming convention.
```text
blueprint::{table}::{record}
blueprint::flags:remote_metadata
blueprint::internal:cache
```
--------------------------------
### Blueprint CLI Script
Source: https://github.com/blueprintframework/framework/blob/main/README.md
The main CLI script for Blueprint, responsible for installation, updates, and running sub-scripts. It manages cache flushing and Artisan commands.
```bash
#!/usr/bin/env bash
# Blueprint CLI Script
# This script is the entry point for all Blueprint commands.
# It handles initial installation, updates, and delegates tasks to sub-scripts.
# Sourcing CLI dependencies
source "scripts/libraries/core.sh"
source "scripts/libraries/utils.sh"
# Running the right sub-scripts for each command
case "$1" in
install)
source "scripts/commands/install.sh"
;;
update)
source "scripts/commands/update.sh"
;;
uninstall)
source "scripts/commands/uninstall.sh"
;;
*) # Default command or help
echo "Usage: blueprint [command]"
echo "Commands: install, update, uninstall"
exit 1
;;
esac
exit 0
```
--------------------------------
### Client API Route Definition
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/routes.md
Defines GET and POST routes for a client API extension. Routes are automatically prefixed with `/api/client/extensions/{extensionname}`.
```php
importStylesheet('/admin/css/extension.css');
// Output:
// In Blade view:
{!! $adminLib->importStylesheet(asset('admin/css/custom.css')) !!}
```
--------------------------------
### Extension Configuration File Paths
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/configuration.md
Illustrates the standard file paths for extension configuration and data within the Blueprint framework.
```text
base_path('.blueprint/extensions/blueprint/private/db/installed_extensions')
- File containing pipe-separated list of installed extension identifiers
base_path('.blueprint/extensions/{identifier}/private/.store/conf.yml')
- YAML configuration for specific extension
base_path('.blueprint/extensions/{identifier}/')
- Root directory for extension files
```
--------------------------------
### Store Extension Data using Blueprint Library
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/configuration.md
Demonstrates how to store arbitrary extension-specific data in the settings table using the Blueprint library.
```php
$blueprint = app(BlueprintBaseLibrary::class);
// Store extension-specific data
$blueprint->dbSet('myext', 'setting_name', 'value');
$blueprint->dbSet('myext', 'config', ['nested' => 'data']);
// Retrieve
$value = $blueprint->dbGet('myext', 'setting_name');
$config = $blueprint->dbGet('myext', 'config', []);
// Batch operations
$blueprint->dbSetMany('myext', [
'key1' => 'value1',
'key2' => 'value2',
]);
$all = $blueprint->dbGetMany('myext', ['key1', 'key2']);
// Delete
$blueprint->dbForget('myext', 'key1');
$blueprint->dbForgetAll('myext'); // Clear entire extension table
```
--------------------------------
### Import Blueprint UI Components
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/ui-components.md
Demonstrates how to import individual UI components or the entire UI library from '@blueprint/ui'.
```tsx
// Import individual components
import { UiAlert } from '@blueprint/ui';
import { UiBadge } from '@blueprint/ui';
import { UiDivider } from '@blueprint/ui';
// Or import all
import { UiAlert, UiBadge, UiDivider } from '@blueprint/ui';
```
--------------------------------
### Framework Console Commands
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/console-commands.md
Lists available framework console commands for cache, metadata, and telemetry management.
```bash
# All framework commands
php artisan bp:cache
php artisan bp:meta
php artisan bp:telemetry
```
--------------------------------
### BlueprintTelemetryCollectionService::collect
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/services.md
Collects detailed telemetry data about the system, the Panel installation, and all installed Blueprint extensions. This data is structured and can be used for monitoring and analytics.
```APIDOC
## BlueprintTelemetryCollectionService::collect
### Description
Collect telemetry data about the system, Panel, and extensions.
### Method
GET
### Endpoint
(Internal method, not directly exposed as an HTTP endpoint)
### Parameters
None
### Response
#### Success Response
- **id** (string) - Unique UUID for telemetry submission.
- **telemetry_version** (integer) - The version of the telemetry schema.
- **blueprint** (object) - Information about the Blueprint framework and its extensions.
- **version** (string) - The version of Blueprint.
- **extensions** (array) - An array of objects, each representing an installed extension.
- **identifier** (string) - The unique identifier of the extension.
- **name** (string) - The display name of the extension.
- **version** (string) - The version of the extension.
- ... more info from extension metadata
- **flags** (object) - Various flags indicating system configuration or features.
- **remote_metadata** (boolean) - Flag indicating if remote metadata is enabled.
- **other_flag** (boolean) - Another configuration flag.
- **docker** (boolean) - Indicates if the system is running in a Docker environment.
- **panel** (object) - Information about the Panel installation.
- **version** (string) - The version of the Panel.
- **phpVersion** (string) - The PHP version used by the Panel.
- **drivers** (object) - Details about the configured drivers for various services.
- **backup** (object) - Backup driver configuration.
- **type** (string) - The type of backup driver (e.g., 's3').
- **cache** (object) - Cache driver configuration.
- **type** (string) - The type of cache driver (e.g., 'redis').
- **database** (object) - Database driver configuration.
- **type** (string) - The type of database driver (e.g., 'mysql').
- **version** (string) - The version of the database.
### Response Example
```json
{
"id": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
"telemetry_version": 1,
"blueprint": {
"version": "v2.1.0",
"extensions": [
{
"identifier": "myext",
"name": "My Extension",
"version": "1.0.0"
}
],
"flags": {
"remote_metadata": true,
"other_flag": false
},
"docker": true
},
"panel": {
"version": "v1.11.0",
"phpVersion": "8.1.0",
"drivers": {
"backup": {"type": "s3"},
"cache": {"type": "redis"},
"database": {
"type": "mysql",
"version": "8.0.0"
}
}
}
}
```
```
--------------------------------
### Import Extension Assets
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/README.md
Import stylesheets and scripts for your extension. Cache-busting versions are automatically added.
```php
echo $blueprint->importStylesheet('/css/extension.css');
echo $blueprint->importScript('/js/extension.js');
```
--------------------------------
### Retrieve Extension Settings
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/README.md
Use dbGet to retrieve a single setting with an optional default value, and dbGetMany to retrieve multiple settings.
```php
$value = $blueprint->dbGet('myext', 'setting_name', 'default');
$all = $blueprint->dbGetMany('myext', ['key1', 'key2']);
```
--------------------------------
### Store Extension Settings
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/README.md
Use dbSet to store a single setting and dbSetMany to store multiple settings for an extension.
```php
$blueprint->dbSet('myext', 'setting_name', 'value');
$blueprint->dbSetMany('myext', [
'setting1' => 'value1',
'setting2' => 'value2',
]);
```
--------------------------------
### Typical Command Structure with Database Interaction
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/blueprint-console-library.md
A standard command structure that utilizes `dbGet` to check the last run time and `dbSet` to record the last run time and result. Includes error handling and basic command options.
```php
class ProcessDataCommand extends Command
{
protected $signature = 'myext:process {--force}';
protected $description = 'Process queued data';
public function __construct(
private BlueprintConsoleLibrary $blueprint,
) {
parent::__construct();
}
public function handle()
{
$force = $this->option('force');
// Check if already running
$lastRun = $this->blueprint->dbGet('myext', 'last_run', 0);
if (!$force && time() - $lastRun < 300) {
$this->info('Command ran recently, skipping...');
return 0;
}
$this->info('Starting process...');
try {
$result = $this->process();
$this->blueprint->dbSet('myext', 'last_run', time());
$this->blueprint->dbSet('myext', 'last_result', $result);
$this->info("Processed {$result['count']} items");
} catch (\Exception $e) {
$this->error("Error: " . $e->getMessage());
return 1;
}
return 0;
}
private function process(): array
{
// Processing logic...
return ['count' => 100, 'status' => 'success'];
}
}
```
--------------------------------
### Create Scheduled Task with Callable
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/console-commands.md
This PHP code demonstrates how to create a scheduled task using a callable function within a file in the `app/BlueprintFramework/Schedules/` directory. It shows how to interact with Blueprint's console library.
```php
call(function () {
$blueprint = app(BlueprintConsoleLibrary::class);
// Do work using $blueprint
$data = $blueprint->dbGet('myext', 'lastrun');
$blueprint->dbSet('myext', 'lastrun', time());
})
->everyFiveMinutes()
->withoutOverlapping()
->onOneServer();
};
```
--------------------------------
### Retrieve Settings
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/README.md
Retrieves extension settings from the database. `dbGet` fetches a single setting by key, and `dbGetMany` fetches multiple settings by an array of keys.
```APIDOC
## Retrieve Settings
### Description
Retrieves extension settings from the database. `dbGet` fetches a single setting, and `dbGetMany` fetches multiple settings.
### Method
PHP Function Calls
### Parameters
#### `dbGet(string $extension, string $key, string $default = null)`
- **extension** (string) - The name of the extension.
- **key** (string) - The name of the setting to retrieve.
- **default** (string, optional) - The default value to return if the setting is not found.
#### `dbGetMany(string $extension, array $keys)`
- **extension** (string) - The name of the extension.
- **keys** (array) - An array of setting keys to retrieve.
### Request Example
```php
$value = $blueprint->dbGet('myext', 'setting_name', 'default');
$all = $blueprint->dbGetMany('myext', ['key1', 'key2']);
```
```
--------------------------------
### Get Blueprint API Base URL
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/placeholder-service.md
Retrieves the base URL for the Blueprint API. The default is 'https://blueprint.zip'.
```php
public function api_url(): string
```
```php
$apiUrl = $service->api_url();
// Returns: https://blueprint.zip
// Use for API calls
$response = Http::get($apiUrl . '/api/extensions/latest');
```
--------------------------------
### Schedule Telemetry Collection Task
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/services.md
Example of how to schedule the BlueprintTelemetryCollectionService to run daily using Laravel's scheduler.
```php
$schedule->call(BlueprintTelemetryCollectionService::class)
->daily();
```
--------------------------------
### Application API Route Definition
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/routes.md
Defines a GET route for an application API extension. This route is intended for internal application use.
```php
group(base_path('routes/blueprint/client/{extensionname}.php'));
```
--------------------------------
### version()
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/placeholder-service.md
Retrieves the current version of the Blueprint framework. Returns 'unknown' if the version is not set.
```APIDOC
## version()
### Description
Get the Blueprint framework version.
### Method
```php
public function version(): string
```
### Returns
Version string (e.g., "v2.1.0") or 'unknown' if version is not set.
### Example
```php
$service = app(BlueprintPlaceholderService::class);
$version = $service->version();
echo "Blueprint version: $version";
```
```
--------------------------------
### Settings Storage Format
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/INDEX.md
Illustrates the format used for storing settings within the Blueprint Framework, including namespaces, keys, and internal identifiers.
```plaintext
blueprint::{namespace}::{key}
blueprint::flags:remote_metadata
blueprint::extensionconfig_{id}_{setting}
blueprint::internal:uuid
blueprint::internal:cache
```
--------------------------------
### Get a single database record
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/blueprint-base-library.md
Fetches a single record from the database. Values are automatically unserialized. Use this when you need to retrieve a specific setting or piece of data.
```php
$blueprint = app(BlueprintBaseLibrary::class);
$setting = $blueprint->dbGet('myext', 'setting_key', 'default_value');
$enabled = $blueprint->dbGet('myext', 'is_enabled', false);
```
--------------------------------
### Get Extension Eggs Endpoint Signature
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/extension-route-controller.md
This is the server-side PHP method signature for retrieving egg IDs configured for a specific extension. It uses a GetRouteEggsRequest object.
```php
public function eggs(GetRouteEggsRequest $request): array
```
--------------------------------
### Send Telemetry Data
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/console-commands.md
Use the `bp:telemetry` command to send telemetry data to the Blueprint telemetry service. This command collects information about your Blueprint installation and extensions.
```bash
php artisan bp:telemetry
```
--------------------------------
### Cached Metadata Structure
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/console-commands.md
Shows the JSON structure for storing cached metadata for each extension. It includes the latest available version from the API and the currently installed local version.
```json
{
"latest_version": "2.1.0",
"local_version": "2.0.0"
}
```
--------------------------------
### Get Latest Version for Extension
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/extension-cached-metadata.md
Retrieves the latest version string for a given extension identifier from the cached metadata. Returns null if the extension is not found or the version is unavailable.
```php
$version = ExtensionCachedMetadata::latestVersionFor('myext');
if ($version) {
echo "Latest available version: $version";
} else {
echo "Metadata not available";
}
```
--------------------------------
### Import Assets
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/README.md
Imports stylesheets and scripts into the application, automatically adding cache-busting versioning.
```APIDOC
## Import Assets
### Description
Imports CSS and JavaScript assets into the application. Cache-busting versioning is automatically applied.
### Method
PHP Function Calls
### Parameters
#### `importStylesheet(string $path)`
- **path** (string) - The path to the stylesheet file (e.g., '/css/extension.css').
#### `importScript(string $path)`
- **path** (string) - The path to the script file (e.g., '/js/extension.js').
### Request Example
```php
echo $blueprint->importStylesheet('/css/extension.css');
echo $blueprint->importScript('/js/extension.js');
```
```
--------------------------------
### Get Extension Eggs via Client API (TypeScript)
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/extension-configuration-controller.md
Fetch extension eggs configuration from the client-side using the ExtensionRouteController endpoint. Ensure the correct extension ID is provided.
```typescript
// Use the ExtensionRouteController endpoint
const eggs = await fetch('/api/client/extensions/blueprint/eggs?id=myext')
.then(r => r.json());
```
--------------------------------
### BlueprintTelemetryCollectionService Constructor
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/services.md
Defines the dependencies required for the telemetry collection service, including extension library access, placeholder service, and seeder.
```php
public function __construct(
private BlueprintExtensionLibrary $blueprint,
private BlueprintPlaceholderService $placeholderService,
private BlueprintSeeder $seeder,
)
```
--------------------------------
### Blueprint Configuration Schema Structure
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/configuration.md
Defines the structure for configuration flags in BlueprintSeeder, including type, description, and default values.
```php
[
'flags' => [
'flagName' => [
'type' => 'boolean|string|number|integer',
'description' => 'Human-readable description',
'default' => mixed,
// Additional metadata
],
],
]
```
--------------------------------
### Store Extension Settings
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/README.md
Allows extensions to store settings in the database. `dbSet` stores a single key-value pair, while `dbSetMany` stores multiple settings at once.
```APIDOC
## Store Extension Settings
### Description
Stores extension settings in the database. `dbSet` is used for a single setting, and `dbSetMany` for multiple settings.
### Method
PHP Function Calls
### Parameters
#### `dbSet(string $extension, string $key, string $value)`
- **extension** (string) - The name of the extension.
- **key** (string) - The name of the setting.
- **value** (string) - The value of the setting.
#### `dbSetMany(string $extension, array $settings)`
- **extension** (string) - The name of the extension.
- **settings** (array) - An associative array of setting names and their values.
### Request Example
```php
$blueprint->dbSet('myext', 'setting_name', 'value');
$blueprint->dbSetMany('myext', [
'setting1' => 'value1',
'setting2' => 'value2',
]);
```
```
--------------------------------
### Get multiple database records
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/blueprint-base-library.md
Fetches multiple records from the database efficiently. Use this to retrieve several related settings or data points at once. If no record keys are provided, all records in the table are fetched.
```php
$records = $blueprint->dbGetMany('myext', ['key1', 'key2', 'key3']);
$allSettings = $blueprint->dbGetMany('myext');
```
--------------------------------
### Create Empty File
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/blueprint-base-library.md
Creates an empty file. This method is deprecated.
```php
/**
* @deprecated beta-2025-09
*/
public function fileMake(string $path): void
```
--------------------------------
### GET /api/client/extensions/blueprint/eggs
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/extension-route-controller.md
Retrieve the list of egg IDs that are configured for a specific extension. The 'id' query parameter specifies the extension identifier. A special value of '-1' indicates that the extension applies to all eggs.
```APIDOC
## GET /api/client/extensions/blueprint/eggs
### Description
Retrieve the list of egg IDs that are configured for a specific extension.
### Method
GET
### Endpoint
/api/client/extensions/blueprint/eggs
### Parameters
#### Query Parameters
- **id** (string) - Optional - Extension identifier. Defaults to 'blueprint'.
### Response
#### Success Response (200)
- **eggs** (array) - An array of egg IDs (integers or strings). The special value "-1" means "show all eggs" (no restriction).
### Request Example
```typescript
// Client-side TypeScript/JavaScript
const response = await fetch('/api/client/extensions/blueprint/eggs?id=myext');
const eggIds = await response.json();
console.log('Eggs for myext:', eggIds);
```
### Response Example
```json
["-1", "1", "5", "12"]
```
```
--------------------------------
### Standard Laravel Environment Variables
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/configuration.md
This snippet lists the standard Laravel .env environment variables that are respected by the Blueprint framework. No Blueprint-specific environment variables are required beyond typical Pterodactyl panel setup.
```dotenv
APP_ENV=production
APP_DEBUG=false
DATABASE_CONNECTION=mysql
DATABASE_HOST=127.0.0.1
DATABASE_PORT=3306
DATABASE_NAME=panel
DATABASE_USERNAME=pterodactyl
DATABASE_PASSWORD=password
CACHE_DRIVER=redis
```
--------------------------------
### Database Persistence with Blueprint
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/README.md
Store and retrieve data using namespaced keys within the Laravel settings table. Use `dbSet` to save values and `dbGet` to retrieve them, providing a default value if the key is not found.
```php
$blueprint->dbSet('myext', 'key', 'value');
$value = $blueprint->dbGet('myext', 'key', 'default');
```
--------------------------------
### Blade Template Example: Settings Form
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/blueprint-extension-controller.md
This Blade template shows a form for managing extension settings, including a checkbox for enabling remote metadata. It uses Blade directives for CSRF protection, method spoofing, and conditional checked state.
```blade
```
--------------------------------
### Access Extension Configuration
Source: https://github.com/blueprintframework/framework/blob/main/_autodocs/api-reference/blueprint-console-library.md
Retrieve the configuration for a specific extension using `extensionConfig`. This is useful for driving command behavior based on extension settings.
```php
public function handle()
{
// Get this extension's config
$myConfig = $this->blueprint->extensionConfig('myext');
if (!$myConfig) {
$this->error('Extension not installed');
return 1;
}
$version = $myConfig['info']['version'] ?? 'unknown';
$this->line("Processing with version: $version");
// Process all extensions
foreach ($this->blueprint->extensions() as $identifier) {
$config = $this->blueprint->extensionConfig($identifier);
// Do work...
}
}
```