companyos/core
最新稳定版本:0.1.152-alpha
Composer 安装命令:
composer require companyos/core
包简介
CompanyOS Core Bundle - Eine modulare Plattform basierend auf DDD, CQRS und Event-Driven Architecture (Alpha Version)
README 文档
README
Ein vollständiges Symfony-Bundle für das CompanyOS-System mit Plugin-Architektur, Authentifizierung, Benutzerverwaltung und API-First-Design.
⚠️ Alpha Version
**Dies ist eine Alpha-Version (0.1.152-alpha
Was funktioniert:
- ✅ Grundlegende Bundle-Struktur (DDD-Layer)
- ✅ Service-Konfiguration
- ✅ Doctrine-Mappings
- ✅ Routing-Grundstruktur
- ✅ Plugin-System-Architektur
- ✅ API-First-Design
Was noch fehlt:
- ❌ Vollständige Controller-Implementierung
- ❌ Unit/Integration Tests
- ❌ Datenbank-Migrationen
- ❌ Vollständige Dokumentation
- ❌ Code Coverage
Architektur
Das CoreBundle folgt einer API-First-Architektur:
- Reine API: Keine UI, keine Assets, keine Templates
- Business-Logik: Domain-Logik, Application-Layer, Infrastructure
- Plugin-Framework: Event- und Service-Extension für Core und API
- Modular: Kann unabhängig vom BackendBundle verwendet werden
Features
- Plugin-System: Dynamisches Laden und Verwalten von Plugins
- OAuth2-Authentifizierung: Vollständige OAuth2-Implementierung mit Password Grant
- Benutzerverwaltung: CRUD-Operationen für Benutzer
- Rollen- und Berechtigungssystem: Flexible Zugriffskontrolle
- Webhook-System: Event-basierte Webhook-Integration
- Event-Driven Architecture: Domain Events und Event Store
- API-First: Alle Funktionen über REST-API verfügbar
Installation
⚠️ Nur für Entwickler und Tester
composer require companyos/core:^0.1.152-alpha
Bundle registrieren
// config/bundles.php return [ // ... andere Bundles CompanyOS\CompanyOSCoreBundle::class => ['all' => true], ];
Konfiguration
# config/packages/companyos_core.yaml companyos_core: plugin: directories: 'custom/plugins,custom/static-plugins' auth: oauth2: enabled: true client_id: 'your-client-id' client_secret: 'your-client-secret'
Plugin-System
Das Plugin-System funktioniert vollständig über Services und erfordert keine Kernel-Erweiterung:
- Automatisches Plugin-Loading: Plugins werden beim Bundle-Boot geladen
- Service-basierte Architektur: Alle Plugin-Funktionen über Services
- Dynamische Routen: Plugin-Routen werden automatisch registriert
- Service-Discovery: Plugin-Services werden automatisch geladen
Plugin erstellen
<?php namespace MyPlugin; use CompanyOS\Bundle\CoreBundle\Domain\Plugin\Domain\AbstractPlugin; class MyPlugin extends AbstractPlugin { public function getPluginName(): string { return 'my-plugin'; } public function getVersion(): string { return '0.1.152-alpha } public function getAuthor(): string { return 'Your Name'; } public function getRoutes(): array { return [ 'my_plugin_route' => '/my-route' ]; } }
Plugin-Konfiguration
{
"name": "my/plugin",
"type": "companyos-plugin",
"autoload": {
"psr-4": {
"MyPlugin\\": "src/"
}
},
"extra": {
"companyos-plugin": {
"plugin-class": "MyPlugin\\MyPlugin"
}
}
}
API-Endpunkte
Authentifizierung
POST /api/auth/login- Benutzer-LoginPOST /api/auth/refresh- Token erneuernPOST /api/auth/logout- LogoutGET /api/auth/profile- Benutzer-Profil
Benutzerverwaltung
GET /api/users- Benutzer auflistenPOST /api/users- Benutzer erstellenGET /api/users/{id}- Benutzer abrufenPUT /api/users/{id}- Benutzer aktualisierenDELETE /api/users/{id}- Benutzer löschen
Plugin-Verwaltung
GET /api/plugins- Plugins auflistenPOST /api/plugins/{name}/install- Plugin installierenPOST /api/plugins/{id}/activate- Plugin aktivierenPOST /api/plugins/{id}/deactivate- Plugin deaktivierenDELETE /api/plugins/{id}- Plugin löschen
Konfiguration
Plugin-Verzeichnisse
parameters: companyos.plugin.directories: 'custom/plugins,custom/static-plugins'
OAuth2-Konfiguration
companyos_core: auth: oauth2: enabled: true access_token_ttl: 3600 refresh_token_ttl: 1209600
Webhook-Konfiguration
companyos_core: webhook: enabled: true max_retries: 3 timeout: 30
Entwicklung
Bundle-Struktur
CompanyOSCoreBundle/
├── Domain/ # Domain-Logik (Entities, Value Objects, Events)
│ ├── Auth/Domain/
│ ├── User/Domain/
│ ├── Role/Domain/
│ ├── Plugin/Domain/
│ ├── Webhook/Domain/
│ ├── Settings/Domain/
│ └── Shared/Domain/
├── Application/ # Use Cases, Commands, Queries, DTOs
│ ├── Auth/
│ ├── User/
│ ├── Role/
│ ├── Plugin/
│ ├── Webhook/
│ ├── Settings/
│ └── Shared/
├── Infrastructure/ # Persistence, Eventing, Services
│ ├── Auth/
│ ├── User/
│ ├── Role/
│ ├── Plugin/
│ ├── Webhook/
│ ├── Settings/
│ └── Shared/
├── DependencyInjection/
├── Resources/
└── ...
Tests
# Unit Tests (noch nicht implementiert) vendor/bin/phpunit # Frontend Tests (noch nicht implementiert) npm test
Kernel-Integration
Das Bundle erweitert nicht den Symfony-Kernel. Die Plugin-Funktionalität wird vollständig über Services bereitgestellt. Siehe KERNEL_INTEGRATION.md für Details.
Roadmap
Version 0.1.152-alpha
- Vollständige Controller-Implementierung
- Basis-Tests (Unit/Integration)
- Datenbank-Migrationen
- Verbesserte Dokumentation
Version 0.1.152-alpha
- Vollständige API-Implementierung
- Frontend-Assets
- Code Coverage > 80%
- CI/CD Pipeline
Version 0.1.152-alpha
- Production-ready
- Vollständige Tests
- Vollständige Dokumentation
- Performance-Optimierungen
Third-Party-Lizenzen
Dieses Bundle verwendet verschiedene Open-Source-Bibliotheken und Frameworks. Hier sind die wichtigsten Dependencies und deren Lizenzen:
Backend Dependencies
- Symfony Framework (MIT) - PHP Web Framework
- Doctrine ORM (MIT) - Object-Relational Mapping
- League OAuth2 Server (MIT) - OAuth2 Server Implementation
- Nelmio API Doc Bundle (MIT) - API Documentation Generator
- PHPUnit (BSD-3-Clause) - Testing Framework
Frontend Dependencies
- Vue.js (MIT) - Progressive JavaScript Framework
- CoreUI (MIT) - Bootstrap-based Admin Template
- Bootstrap (MIT) - CSS Framework
- Webpack Encore (MIT) - Asset Management
Vollständige Dependency-Liste
Für eine vollständige Liste aller verwendeten Pakete und deren Lizenzen siehe:
composer.jsonfür PHP-Dependenciespackage.jsonfür JavaScript-Dependencies
Alle verwendeten Pakete sind Open-Source und unter permissiven Lizenzen (hauptsächlich MIT) verfügbar.
Lizenz
MIT License - siehe LICENSE Datei.
Support
Bei Fragen oder Problemen erstellen Sie ein Issue im Repository oder kontaktieren Sie das Entwicklungsteam.
Contributing
- Fork das Repository
- Erstelle einen Feature-Branch (
git checkout -b feature/amazing-feature) - Committe deine Änderungen (
git commit -m 'Add some amazing feature') - Push zum Branch (
git push origin feature/amazing-feature) - Öffne einen Pull Request
Doctrine-Integration
Das Bundle stellt automatisch alle Core-Entities für Doctrine bereit. Um die Entities in die Datenbank zu schreiben:
1. Doctrine-Konfiguration im Hauptprojekt
Füge folgende Konfiguration in dein config/packages/doctrine.yaml hinzu:
doctrine: dbal: types: uuid: CompanyOS\Bundle\CoreBundle\Infrastructure\Persistence\Doctrine\UuidType email: CompanyOS\Bundle\CoreBundle\Infrastructure\Persistence\Doctrine\EmailType orm: mappings: CompanyOSCore: type: attribute is_bundle: false dir: '%kernel.project_dir%/vendor/companyos/core/src/Domain' prefix: 'CompanyOS\Bundle\CoreBundle\Domain' alias: CompanyOS CompanyOSUser: type: attribute is_bundle: false dir: '%kernel.project_dir%/vendor/companyos/core/src/Domain/User/Domain/Entity' prefix: 'CompanyOS\Bundle\CoreBundle\Domain\User\Domain\Entity' alias: CompanyOSUser CompanyOSAuth: type: attribute is_bundle: false dir: '%kernel.project_dir%/vendor/companyos/core/src/Domain/Auth/Domain/Entity' prefix: 'CompanyOS\Bundle\CoreBundle\Domain\Auth\Domain\Entity' alias: CompanyOSAuth CompanyOSRole: type: attribute is_bundle: false dir: '%kernel.project_dir%/vendor/companyos/core/src/Domain/Role/Domain/Entity' prefix: 'CompanyOS\Bundle\CoreBundle\Domain\Role\Domain\Entity' alias: CompanyOSRole CompanyOSPlugin: type: attribute is_bundle: false dir: '%kernel.project_dir%/vendor/companyos/core/src/Domain/Plugin/Domain/Entity' prefix: 'CompanyOS\Bundle\CoreBundle\Domain\Plugin\Domain\Entity' alias: CompanyOSPlugin CompanyOSWebhook: type: attribute is_bundle: false dir: '%kernel.project_dir%/vendor/companyos/core/src/Domain/Webhook/Domain/Entity' prefix: 'CompanyOS\Bundle\CoreBundle\Domain\Webhook\Domain\Entity' alias: CompanyOSWebhook CompanyOSSettings: type: attribute is_bundle: false dir: '%kernel.project_dir%/vendor/companyos/core/src/Domain/Settings/Domain/Entity' prefix: 'CompanyOS\Bundle\CoreBundle\Domain\Settings\Domain\Entity' alias: CompanyOSSettings CompanyOSEvent: type: attribute is_bundle: false dir: '%kernel.project_dir%/vendor/companyos/core/src/Domain/Event' prefix: 'CompanyOS\Bundle\CoreBundle\Domain\Event' alias: CompanyOSEvent
2. Datenbank-Schema erstellen
# Schema erstellen bin/console doctrine:schema:create # Oder Schema aktualisieren bin/console doctrine:schema:update --force # Oder Migrationen generieren bin/console doctrine:migrations:diff bin/console doctrine:migrations:migrate
Verfügbare Entities
Das Bundle stellt folgende Entities bereit:
- User: Benutzer-Verwaltung (
usersTabelle) - Role: Rollen-Verwaltung (
rolesTabelle) - UserRole: Benutzer-Rollen-Zuordnung (
user_rolesTabelle) - Client: OAuth2-Clients (
oauth_clientsTabelle) - AccessToken: OAuth2-Access-Tokens (
oauth_access_tokensTabelle) - RefreshToken: OAuth2-Refresh-Tokens (
oauth_refresh_tokensTabelle) - Plugin: Plugin-Verwaltung (
pluginsTabelle) - Webhook: Webhook-Verwaltung (
webhooksTabelle) - CompanySettings: Unternehmens-Einstellungen (
company_settingsTabelle) - StoredEvent: Event Store (
stored_eventsTabelle)
统计信息
- 总下载量: 81
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-25