Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Acspanel Wordpress Laravel Package

acs/acspanel-wordpress

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Install ACSPanel Core Ensure ACSPanel is installed and configured as the base hosting control panel. This bundle extends its functionality for WordPress farms.

  2. Bundle Installation Add the bundle to composer.json of your ACSPanel project:

    composer require acs/acspanel-wordpress
    

    Register the bundle in config/bundles.php:

    return [
        // ...
        AltCtrlSupr\ACSPanelWordpressBundle\ACSPanelWordpressBundle::class => ['all' => true],
    ];
    
  3. Database Migration Run the bundle’s migration to create the wp_hosting table (links hostings to WordPress databases):

    php bin/console doctrine:migrations:migrate
    
  4. First WordPress Farm

    • Create a new hosting in ACSPanel (e.g., via CLI or UI).
    • Assign the WordPress template to the hosting (configured in ACSPanel’s hosting templates).
    • The bundle auto-generates:
      • A symlinked WordPress core directory (shared across all blogs).
      • A unique wp-content folder per blog (stored in hosting_id/wp-content).
      • A dedicated MySQL database/user (via ACSPanel’s database management).
  5. Verify Setup Access the WordPress admin URL (e.g., https://yourdomain.com/wp-admin). The dashboard should load with the correct database connection.


First Use Case: Deploying a New WordPress Site

  1. Create Hosting Use ACSPanel’s UI/CLI to add a new hosting and select the "WordPress" template.

    php bin/console acspanel:hosting:create --name="example.com" --template="wordpress"
    
  2. Bundle Handles the Rest

    • Symlinks WordPress core to the hosting’s root.
    • Initializes wp-config.php with the correct DB credentials (auto-fetched from ACSPanel’s wp_hosting table).
    • Generates a unique wp-content directory for themes/plugins/uploads.
  3. Access WordPress Point DNS to the hosting’s IP, then install WordPress via the web installer (or pre-populate with a default theme).


Implementation Patterns

1. WordPress Multitenancy Architecture

  • Shared Core, Isolated Content: All blogs share the same WordPress core files (symlinked to /var/www/acspanel/wordpress/), but each has its own:

    • wp-content/ (themes, plugins, uploads).
    • MySQL database (created via ACSPanel’s database management).
    • wp-config.php (auto-generated with unique DB credentials).
  • Folder Structure:

    /var/www/acspanel/
    ├── wordpress/          # Symlinked core (shared)
    └── hostings/
        ├── example1.com/
        │   ├── wp-content/ # Unique per blog
        │   └── wp-config.php # Auto-generated
        └── example2.com/
    

2. Integration with ACSPanel Workflows

  • Hosting Templates: Configure a "WordPress" template in ACSPanel’s HostingTemplate entity with:

    # config/acspanel/hosting_templates.yaml
    wordpress:
        type: "wordpress"
        core_path: "/var/www/acspanel/wordpress"
        content_path: "wp-content"
        db_prefix: "wp_"
    

    Assign this template when creating hostings.

  • Database Management: Use ACSPanel’s Database and DatabaseUser entities to manage WordPress databases. The bundle hooks into these to populate wp_hosting.

  • Automated wp-config.php: The bundle generates wp-config.php dynamically using a twig template. Override this template to customize:

    define('DB_NAME', '{{ database.name }}');
    define('DB_USER', '{{ database.user }}');
    define('DB_PASSWORD', '{{ database.password }}');
    define('WP_CONTENT_DIR', '{{ hosting.path }}/wp-content');
    

3. CLI Management

  • Create/Update Hostings:

    # Create a WordPress hosting
    php bin/console acspanel:hosting:create --name="blog.example.com" --template="wordpress"
    
    # Rebuild symlinks for a hosting (if core files change)
    php bin/console acspanel-wordpress:hosting:setup --hosting-id=1
    
  • Backup/Restore: Leverage ACSPanel’s backup system to include:

    • wp-content/ (via HostingBackup).
    • MySQL database (via DatabaseBackup).

4. Customizing WordPress Behavior

  • Per-Blog Plugins/Themes: Store plugins/themes in hosting_id/wp-content/plugins/ or hosting_id/wp-content/themes/. Use mu-plugins in the shared core for farm-wide plugins.

  • Domain Mapping: Use WordPress’s WordPress Multisite or plugins like WP Multi Network if managing subdomains.

  • Caching: Configure shared caching (e.g., Redis) in wp-config.php:

    define('WP_CACHE', true);
    define('WP_REDIS_HOST', 'redis');
    

5. Extending the Bundle

  • Custom Hosting Setup: Override the bundle’s HostingSetupCommand to add pre/post-install hooks:

    // src/Command/CustomWordpressSetupCommand.php
    namespace App\Command;
    
    use AltCtrlSupr\ACSPanelWordpressBundle\Command\HostingSetupCommand;
    use Symfony\Component\Console\Input\InputInterface;
    use Symfony\Component\Console\Output\OutputInterface;
    
    class CustomWordpressSetupCommand extends HostingSetupCommand
    {
        protected function execute(InputInterface $input, OutputInterface $output): int
        {
            parent::execute($input, $output);
            // Add custom logic (e.g., install a default theme)
            $this->installDefaultTheme($input->getArgument('hostingId'));
            return 0;
        }
    }
    
  • Custom Database Tables: Extend the wp_hosting table via migrations or use ACSPanel’s HostingExtension trait:

    // src/Entity/ExtendedHosting.php
    use AltCtrlSupr\ACSPanelWordpressBundle\Entity\HostingExtension;
    
    class ExtendedHosting extends Hosting
    {
        use HostingExtension;
    
        // Add custom fields (e.g., 'default_theme')
    }
    

Gotchas and Tips

Pitfalls

  1. Symlink Permissions:

    • Ensure the web server user (e.g., www-data) has read/execute permissions on the shared WordPress core:
      chmod -R a+x /var/www/acspanel/wordpress/
      chown -R www-data:www-data /var/www/acspanel/hostings/
      
    • Fix: If symlinks break, run:
      php bin/console acspanel-wordpress:hosting:setup --hosting-id=1 --force
      
  2. Database Prefixes:

    • The bundle uses wp_ by default. Conflict risk if hostings share a database (unlikely, but possible with custom setups).
    • Fix: Override the db_prefix in the hosting template or wp-config.php.
  3. WordPress Core Updates:

    • Updating the shared core requires rebuilding symlinks for all hostings:
      # Update core
      cd /var/www/acspanel/wordpress/
      git pull origin master
      
      # Rebuild symlinks for all WordPress hostings
      php bin/console acspanel-wordpress:hosting:setup-all
      
    • Tip: Use ACSPanel’s HostingEvent system to trigger this automatically after updates.
  4. PHP Memory Limits:

    • WordPress farms may hit memory limits during plugin activation or large imports.
    • Fix: Increase memory_limit in the shared php.ini or per-hosting .user.ini:
      memory_limit = 512M
      
  5. Multisite vs. Multitenancy:

    • This bundle does not support WordPress Multisite. Each blog is a separate WordPress install with its own wp-config.php and database.
    • Workaround: Use plugins like WP Multi Network for multisite-like functionality.

Debugging Tips

  1. Check Symlinks:
    • Verify symlinks are intact:
      ls -la /var/www/
      
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
iio/libmergepdf
redaxo/project
zatona-eg/zatona-eg-api
patrickbussmann/oauth2-apple
3brs/enterprise-security-bundle
ardenexal/fhir-models
ardenexal/fhir-validation
dpfx/laravel-livewire-wizards
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle
dmstr/api-platform-utils-bundle
dmstr/api-configuration-bundle
chrisdev/ux-components
crudly/encrypted
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony