### Install Pelican Panel Plugins Source: https://context7.com/pelican-dev/plugins/llms.txt This snippet outlines the steps to download, extract, and install plugins for the Pelican panel. It involves using wget and unzip for downloading, cp for copying plugin folders, and chown for setting correct file permissions. Manual installation via the panel's UI is also mentioned. ```bash # Download and extract the repository wget https://github.com/pelican-dev/plugins/archive/refs/heads/main.zip unzip main.zip # Copy desired plugin folders to panel plugins directory cp -r plugins-main/billing /var/www/pelican/plugins/ cp -r plugins-main/tickets /var/www/pelican/plugins/ # Set proper permissions chown -R www-data:www-data /var/www/pelican/plugins/ # Navigate to your panel's plugin management page # Click the "Install" button next to each plugin ``` -------------------------------- ### Manage User Server Resources with PHP Source: https://context7.com/pelican-dev/plugins/llms.txt This PHP example shows how users can create their own servers within predefined resource limits using the User Creatable Servers plugin. It covers assigning limits, checking availability, and creating servers, ensuring compliance with allocated CPU, memory, and disk space. ```php $user->id, 'cpu' => 400, // 400% total CPU (4 cores) 'memory' => 8192, // 8GB total RAM 'disk' => 51200, // 50GB total disk 'server_limit' => 5 // Maximum 5 servers ]); // Check remaining resources $cpuLeft = $limits->getCpuLeft(); // Returns available CPU $memoryLeft = $limits->getMemoryLeft(); // Returns available memory in MB $diskLeft = $limits->getDiskLeft(); // Returns available disk in MB // Check if user can create a server with specific resources $canCreate = $limits->canCreateServer( cpu: 100, // 1 core memory: 2048, // 2GB disk: 10240 // 10GB ); if ($canCreate) { // User creates a server $server = $limits->createServer( name: 'My Minecraft Server', egg: Egg::where('name', 'Paper')->first(), cpu: 100, memory: 2048, disk: 10240 ); // Returns Server model instance or false if limits exceeded // Server is deployed to nodes tagged 'user_creatable_servers' } // The CreateServerAction provides a Filament form UI for users // Automatically calculates and enforces resource limits // Form shows remaining resources and validates input ``` -------------------------------- ### Configure Minecraft Modrinth Integration for Downloads (PHP) Source: https://context7.com/pelican-dev/plugins/llms.txt This PHP example outlines the server-side configuration for downloading Minecraft mods and plugins from Modrinth using the Pelican panel. It specifies the required egg features (`modrinth_mod`, `modrinth_plugins`) and tags (`minecraft`, mod loader type) needed to enable these functionalities. The plugin integrates by adding navigation items and providing a download interface. ```php 'Company SSO', 'display_icon' => 'tabler-building', 'display_color' => '#0066cc', 'client_id' => 'pelican-panel-client', 'client_secret' => 'secret_from_oidc_provider', 'base_url' => 'https://auth.company.com/realms/main', 'verify_jwt' => true, 'jwt_public_key' => '-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----', 'create_missing_users' => true, // Auto-create users on first login 'link_missing_users' => false // Don't link to existing accounts ]); // The provider automatically registers with Socialite // Login button appears on panel login page with custom name/icon/color // OAuth Schema provides configuration $schema = new GenericOIDCProviderSchema($provider); $config = $schema->getServiceConfig(); // Returns: // [ // 'client_id' => 'pelican-panel-client', // 'client_secret' => 'secret_...', // 'base_url' => 'https://auth.company.com/realms/main', // 'verify_jwt' => true, // 'jwt_public_key' => '-----BEGIN PUBLIC KEY-----...' // ] // Provider handles OAuth flow automatically // Users redirect to OIDC provider, authenticate, return to panel // New users created if create_missing_users is true ``` -------------------------------- ### Create and Manage Support Tickets with PHP Source: https://context7.com/pelican-dev/plugins/llms.txt This snippet demonstrates how to create, assign, and answer support tickets using the Tickets plugin. It utilizes Eloquent models and enums for ticket properties. The plugin automatically notifies the author upon receiving an answer. ```php 'Server not starting', 'category' => TicketCategory::Technical, 'priority' => TicketPriority::High, 'description' => 'My Minecraft server fails to start after updating to 1.20', 'server_id' => $server->id, 'author_id' => auth()->id(), 'is_answered' => false ]); // Admin assigns ticket to support staff $supportUser = User::where('email', 'support@example.com')->first(); $ticket->assignTo($supportUser); // Admin answers the ticket $ticket->answer('The issue is caused by incompatible plugins. Please remove FooBar plugin and try again.'); // This sends a database notification to the ticket author // Notification includes link back to the ticket with the answer // Ticket properties $isAnswered = $ticket->is_answered; // true/false $answer = $ticket->answer; // Answer text with markdown support $assignedTo = $ticket->assignedUser; // User model or null ``` -------------------------------- ### Pelican Billing Plugin: Create Minecraft Server Product Source: https://context7.com/pelican-dev/plugins/llms.txt Demonstrates how to create a new billable product for a Minecraft server using the Pelican Billing plugin. It specifies server resources like CPU, memory, and disk, and sets up monthly and yearly pricing tiers. The product is automatically synced with Stripe. ```php 'Basic Minecraft Server', 'description' => '2GB RAM Minecraft server with Paper', 'egg_id' => Egg::where('name', 'Paper')->first()->id, 'cpu' => 100, // 100% CPU 'memory' => 2048, // 2GB RAM 'disk' => 10240, // 10GB disk 'swap' => 512, // 512MB swap 'ports' => [25565], // Minecraft default port 'tags' => ['minecraft'], // Node deployment tags 'allocation_limit' => 1, 'database_limit' => 2, 'backup_limit' => 3 ]); // Product automatically syncs to Stripe // $product->stripe_id will be populated // Add pricing tiers $monthlyPrice = ProductPrice::create([ 'product_id' => $product->id, 'price' => 999, // $9.99 in cents 'interval_type' => PriceInterval::Month, 'interval_value' => 1 ]); $yearlyPrice = ProductPrice::create([ 'product_id' => $product->id, 'price' => 9999, // $99.99 in cents (save 17%) 'interval_type' => PriceInterval::Year, 'interval_value' => 1 ]); ``` -------------------------------- ### Manage Cloudflare Subdomains with PHP Source: https://context7.com/pelican-dev/plugins/llms.txt This code illustrates how to manage DNS subdomains using the Subdomains plugin and the Cloudflare API. It covers creating Cloudflare domains, creating subdomains for servers, and updating or deleting them, which automatically synchronizes with Cloudflare. ```php 'game-servers.com', 'cloudflare_zone_id' => 'abc123...', 'cloudflare_api_token' => 'token_here' ]); // User creates a subdomain for their server $server = Server::find(1); $subdomain = Subdomain::create([ 'name' => 'myserver', // Creates myserver.game-servers.com 'record_type' => 'A', // A or AAAA record 'domain_id' => $domain->id, 'server_id' => $server->id ]); // Subdomain automatically creates DNS record on Cloudflare // Points to server's primary allocation IP // DNS record created with: // - name: myserver // - type: A // - content: 123.45.67.89 (server IP) // - ttl: 120 // - proxied: false // Update subdomain (automatically updates Cloudflare) $subdomain->update(['name' => 'newname']); // Delete subdomain (automatically removes from Cloudflare) $subdomain->delete(); // Get full domain name $fullDomain = $subdomain->getLabel(); // "myserver.game-servers.com" ``` -------------------------------- ### Create Announcement for Alert Banners (PHP) Source: https://context7.com/pelican-dev/plugins/llms.txt This PHP snippet illustrates how to create and configure announcements to be displayed as alert banners across Pelican panel interfaces. It defines announcement details like title, body, type, visibility panels, and display duration. The `shouldDisplay` method checks if an announcement is active and visible for the current context. ```php 'Scheduled Maintenance', 'body' => 'Panel will be down for maintenance on Dec 25 at 2:00 AM UTC', 'type' => 'warning', // success, info, warning, danger 'enabled' => true, 'panels' => ['app', 'admin'], // Which panels to show on 'start_at' => now(), 'end_at' => now()->addDays(7) ]); // Announcement displays as alert banner on specified panels // Automatically shows/hides based on start_at and end_at dates // Users see banner at top of panel matching title, body, and type // Check if announcement should display $shouldDisplay = $announcement->shouldDisplay($panel); // Returns true if: // - enabled is true // - current time is between start_at and end_at // - panel ID is in panels array // Announcements load on panel boot // AlertBanner creates notification with: // - Unique ID: 'announcement_' . $announcement->id // - Title: announcement title // - Body: announcement body // - Status: announcement type (warning/success/etc) ``` -------------------------------- ### Pelican Billing Plugin: Stripe Configuration Source: https://context7.com/pelican-dev/plugins/llms.txt This PHP code block shows how to configure the Pelican Billing plugin for Stripe integration. It lists the required environment variables like Stripe keys and currency, and demonstrates saving settings. The plugin handles automatic synchronization of products and prices with Stripe. ```php 'pk_live_xxxxxxxxxxxxx', 'secret' => 'sk_live_xxxxxxxxxxxxx', 'currency' => 'USD', 'deployment_tags' => ['minecraft', 'game-servers'] ]; // The plugin handles Stripe product/price synchronization automatically // Products sync to Stripe when created/updated // Prices sync to Stripe when created // Deletions cascade to Stripe ``` -------------------------------- ### Pelican Billing Plugin: Process Customer Orders Source: https://context7.com/pelican-dev/plugins/llms.txt This PHP snippet illustrates the order processing workflow for the Pelican Billing plugin. It covers creating orders for customers, retrieving Stripe checkout sessions for payment, activating orders post-payment, checking for expired orders, and manual cancellation. ```php id())->firstOrCreate([ 'user_id' => auth()->id() ]); $productPrice = ProductPrice::find(1); $order = Order::create([ 'customer_id' => $customer->id, 'product_price_id' => $productPrice->id, 'status' => OrderStatus::Pending ]); // Get Stripe checkout session $session = $order->getCheckoutSession(); // Returns Stripe checkout session with redirect URL: $session->url // After payment success (webhook/callback) $order->activate($stripePaymentIntentId); // This will: // - Create the server automatically // - Set expiration date based on interval // - Unsuspend server if it was suspended // Check if order has expired (run via cron) if ($order->checkExpire()) { // Server was suspended and order marked as expired } // Manual order cancellation $order->close(); // Suspends server and marks order as closed ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.