phalcon/ide-stubs
phalcon/ide-stubs provides up-to-date IDE stubs for the Phalcon PHP framework, enabling autocompletion, type hinting, and code navigation in editors like PhpStorm. It helps developers explore Phalcon classes and methods with accurate metadata and no runtime dependency.
Installation Add the package via Composer (if available) or manually include the stubs in your project:
composer require phalcon/ide-stubs
(Note: Since the package is for Phalcon, ensure your project uses Phalcon PHP framework.)
Enable Stubs
Place the stubs in your IDE’s metadata directory (e.g., vendor/phalcon/ide-stubs/stubs for PHPStorm) or configure your IDE to use them:
File > Settings > Languages & Frameworks > PHP > Stub Files and add the stubs path.php-stubs extension and point it to the stubs directory.First Use Case
Open a Phalcon model, service, or DI container class. Autocomplete, type hints, and method signatures should now appear without errors (e.g., Phalcon\Di\Injectable, Phalcon\Mvc\Model).
Leveraging Autocomplete
Phalcon\Mvc\Model, Phalcon\Di\FactoryDefault) to avoid manual @var annotations.new \Phalcon\Mvc\Model\ triggers autocomplete for find(), create(), etc.Dependency Injection (DI) Clarity
Phalcon\Di\Injectable methods (e.g., get(), setService()) provide real-time hints for service binding.$this->di->get('modelsManager'); // Autocomplete shows available services.
Model and ORM Support
Phalcon\Mvc\Model\Behavior and Phalcon\Mvc\Model\Relation for seamless ORM interactions.hasMany() or belongsTo() relations populate with correct parameters.Configuration and Events
Phalcon\Events\Manager and Phalcon\Config for event-driven workflows.Phalcon\Mvc\Application events.Custom Stubs for Extensions
phalcon/validation), generate or include their stubs alongside the core package.IDE-Specific Quirks
Settings > Directories to avoid accidental overwrites.Stub Version Mismatch
README or release notes).Dynamic Properties
__get(), __set()) may not be fully stubbed. Use @property annotations for dynamic properties:
/** @property string $nonExistentProperty */
Namespace Conflicts
Phalcon or Di to prevent IDE conflicts with stubbed namespaces.Stub Validation
phalcon/devtools skeleton). If autocompletion fails, the stubs may be incomplete.Fallback to DocBlocks
/**
* @method static \App\Models\User findFirst($parameters = null)
*/
class User extends \Phalcon\Mvc\Model {}
Generating Custom Stubs
phpDocumentor or phpstan/phpdoc-parser to generate stubs for custom Phalcon extensions.Merge Stubs
CI/CD Integration
composer post-install script to symlink stubs to a project-wide stubs/ directory:
{
"scripts": {
"post-install-cmd": [
"php -r \"if (!file_exists('stubs')) symlink('vendor/phalcon/ide-stubs/stubs', 'stubs');\""
]
}
}
Community Contributions
How can I help you explore Laravel packages today?