zetacomponents/base
Core utilities for the Zeta Components (eZ Components) library. Provides foundational classes for exceptions, autoloading, file and path handling, and common helpers used across components. Suitable as a shared base dependency for PHP projects.
zetacomponents/base package aligns well with Laravel’s modular architecture, offering reusable, loosely coupled components (e.g., Zeta_Component_Base, Zeta_Component_Exception). This can complement Laravel’s service container and dependency injection patterns.Zeta_Component_File, Zeta_Component_Http).ServiceProvider to register components as singletons or bindings.Zeta_Component_Exception could be wrapped in facades for Laravel’s fluent syntax.Zeta_Component_Event) is not natively Laravel-friendly and may require custom bridges.Zeta_Component_Db_Table).Zeta_Component_Http could supplement Laravel’s HTTP layer but would require careful conflict resolution (e.g., middleware vs. Zeta’s request handling).mysql_* functions in Zeta_Component_Db). Requires polyfills or strict isolation.app() helper or decorators.Zeta_Component_Http for XSS/SQLi).Zeta_Component_Cache) not available in Laravel’s ecosystem?symfony/http-client for HTTP, spatie/laravel-caching for cache)?app()->make() or decorators.Zeta_Component_Event to Laravel’s Event facade using custom listeners.Zeta_Component_Exception into Laravel’s exception handler.Zeta vs. Zend, Zf)."zetacomponents/base": "vendor/zetacomponents-base") to avoid collisions.Zeta_Component_File, Zeta_Component_Http) and map to Laravel equivalents or custom wrappers.Zeta_Component_Db_Table with Eloquent or Query Builder.Zeta namespace/module in Laravel (e.g., app/Zeta/) to encapsulate legacy code.config/app.php to exclude Zeta autoloading in production.ZetaServiceProvider.
public function register() {
$this->app->singleton('zeta.file', function () {
return new Zeta_Component_File();
});
}
Facades/Zeta.php:
public static function file() { return app('zeta.file'); }
Zeta_Component_Http via constructor).app()->bind('zeta.*', function () { Log::warning('Zeta Component used'); })).symfony/http-client for HTTP).| Zeta Component | Laravel Equivalent | Integration Notes |
|---|---|---|
Zeta_Component_File |
Illuminate\Support\Facades\File |
Use Laravel’s Storage facade instead. |
Zeta_Component_Http |
Illuminate\Support\Facades\Http |
Prefer Guzzle-based Http client. |
Zeta_Component_Db_Table |
Illuminate\Database\Eloquent\Model |
Migrate to Eloquent or Query Builder. |
Zeta_Component_Cache |
Illuminate\Support\Facades\Cache |
Use Laravel’s cache drivers. |
Zeta_Component_Event |
Illuminate\Support\Facades\Event |
Bridge via custom event listeners. |
Zeta_Component_Db_Table for legacy data access).Zeta_Component_Log) until refactoring.public function test_zeta_http_integration() {
$response = Http::fake();
$zetaHttp = app('zeta.http')->get('https://example.com');
$response->assertSent(function ($request) { ... });
}
composer.json to avoid breaking changes.composer audit).README.md in the Zeta/ module explaining usage patterns.spatie/laravel-activitylog for event tracking).dd(), debugbar). Override exception handlers:
$this->app->errorHandler(function ($e) {
if ($e instanceof Zeta_Component_Exception) {
return response()->json(['error' => $e->getMessage()], 500);
}
return app()->make(\Illuminate\Foundation\Bootstrap\HandleExceptions::class)->render($e);
});
Zeta_Component_Base directly). Prefer composition over inheritance.How can I help you explore Laravel packages today?