A powerful PHP library that generates code based on ATProto lexicons. Blugen reads lexicon JSON files and generates corresponding PHP classes with proper namespacing, type definitions, and structure following PSR standards.
This package is currently under active development.
For production use, please refer to official releases only. The main branch may contain unstable features and breaking changes.
- 🚀 Automated Code Generation: Generate PHP classes from ATProto lexicon definitions
- 📁 Smart Namespacing: Automatic PHP namespace resolution from lexicon paths
- 🔧 Multi-file Generation: Support for generating multiple related classes from single lexicons
- ⚡ CLI Interface: Easy-to-use command-line interface for code generation
- 📋 PSR Compliant: Follows PSR-4 autoloading and PSR coding standards
- 🔍 Type Safety: Generates type-safe PHP classes with proper docblocks
composer require shahmal1yev/blugen
git clone https://github.com/shahmal1yev/blugen.git
cd blugen
composer install
Generate PHP classes from ATProto lexicons:
./bin/blugen generate
Default configuration is stored in config/codegen.php
:
return [
'lexicons' => [
'source' => __DIR__ . "/../atproto/lexicons",
],
'output' => [
'base_namespace' => "BlugenGenerator\\",
],
];
composer test
# or
vendor/bin/phpunit
vendor/bin/phpstan analyse
# Install dependencies
composer install
# Run tests
composer test
# Generate code from lexicons
./bin/blugen generate
Create a custom configuration file:
// config/custom.php
return [
'lexicons' => [
'source' => __DIR__ . "/lexicons",
],
'output' => [
'base_namespace' => "Codegen\\",
],
];
We welcome contributions! Please see CONTRIBUTING.md for details.
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Make your changes
- Run tests:
composer test
- Run static analysis:
vendor/bin/phpstan analyse
- Commit changes:
git commit -m 'Add amazing feature'
- Push to branch:
git push origin feature/amazing-feature
- Submit a pull request
- Follow PSR-12 coding standards
- Write comprehensive tests
- Document public APIs
- PHP 8.1 or higher
- Composer
This project is licensed under the MIT License. See LICENSE for details.
Made with ❤️ by the @shahmal1yev. Built for the ATProto ecosystem.