mralaminahamed/divi-theme-stubs

Divi theme function and class declaration stubs for static analysis and IDE completion.

Maintainers

Package info

github.com/mralaminahamed/phpstan-divi-theme-stubs

Documentation

Language:Shell

pkg:composer/mralaminahamed/divi-theme-stubs

Fund package maintenance!

mralaminahamed

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v5.7.4 2026-06-19 12:45 UTC

This package is auto-updated.

Last update: 2026-06-19 12:47:33 UTC


README

Latest Version Downloads License PHP Version Tweet

PHP stub declarations for the Divi Theme to enhance IDE completion and static analysis capabilities. Generated using php-stubs/generator directly from the source code.

🚀 Features

  • Complete function, class, and interface declarations
  • Constant definitions for proper static analysis
  • IDE autocompletion support
  • PHPStan integration
  • Regular updates with latest Divi theme versions
  • Excludes unnecessary files (widgets, WooCommerce integrations, etc.)
  • Support for both manual installation and Composer

📋 Requirements

  • PHP >= 7.4
  • Composer for dependency management
  • Git for version control
  • Valid Elegant Themes account credentials (for development)

📦 Installation

Via Composer (Recommended)

# Install as a development dependency
composer require --dev mralaminahamed/divi-theme-stubs

# Or specify a version
composer require --dev mralaminahamed/divi-theme-stubs:^4.0

Manual Installation

Download the stub files directly:

🔧 Configuration

PHPStan Integration

Add the stubs to your phpstan.neon configuration:

parameters:
    bootstrapFiles:
        - vendor/mralaminahamed/divi-theme-stubs/divi-theme-constants-stubs.stub
        - vendor/mralaminahamed/divi-theme-stubs/divi-theme-stubs.stub

IDE Configuration

PhpStorm

  1. Go to SettingsPHPInclude Path
  2. Add the directory containing the stub files

VS Code with Intelephense

Add to your .vscode/settings.json:

{
    "intelephense.stubs": [
        "wordpress",
        "divi-theme-stubs"
    ]
}

VS Code with PHP Intellisense

Add to your settings.json:

{
    "php.stubs": [
        "vendor/mralaminahamed/divi-theme-stubs/divi-theme-stubs.stub",
        "vendor/mralaminahamed/divi-theme-stubs/divi-theme-constants-stubs.stub"
    ]
}

🔍 Usage Example

<?php

// Your code will now have full IDE support
use ET_Builder_Module;

class MyCustomModule extends ET_Builder_Module {
    public function init() {
        $this->name = 'Custom Module';
        $this->slug = 'custom_module';
        // IDE will provide proper autocompletion for all properties
    }
}

// Constants are properly defined
if (defined('ET_BUILDER_VERSION')) {
    // Your implementation
}

🛠 Development

Setting Up Development Environment

  1. Clone the repository:
git clone https://github.com/mralaminahamed/phpstan-divi-theme-stubs.git
cd phpstan-divi-theme-stubs
  1. Install dependencies:
composer install
  1. Configure authentication:
# Add to your ~/.bashrc or ~/.zshrc
export ET_USERNAME='your_elegant_themes_username'
export ET_API_KEY='your_elegant_themes_api_key'

Available Commands

# Generate stubs
composer generate

# Release new version
composer release

# Release only latest version
composer release:latest

# Clean up generated files
composer cleanup

# Run all checks
composer check

# Run static analysis
composer analyze

# Run coding standards check
composer cs

Directory Structure

.
├── bin/
│   ├── generate.sh
│   └── release.sh
├── configs/
│   └── finder.php
├── lib/
│   └── shared.sh
├── source/
├── tests/
├── composer.json
└── README.md

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Follow PSR-12 coding standards
  • Add/update tests for new features
  • Update documentation for significant changes
  • Verify stub generation works for latest Divi version

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

💬 Support

⚠️ Known Issues and Limitations

  • Some dynamic properties and methods may not be properly stubbed
  • WooCommerce integration stubs are excluded by default
  • Custom module properties need to be explicitly declared

📝 Changelog

See CHANGELOG.md for all notable changes.

Made with ❤️ by Mr Alamin Ahamed