baks-dev/ozon
Laravel/PHP модуль для работы с Ozon API. Установка через Composer (baks-dev/ozon), поддержка PHP 8.4+, версия 7.4.10. В комплекте тесты PHPUnit (группа ozon). Лицензия MIT.
--group=ozon) hints at a modular test suite, easing integration into CI/CD pipelines.src/OzonClient.php).tests/OzonOrderTest.php).encrypted in .env or database).OzonApiException for API failures).| Risk | Mitigation Strategy | Priority |
|---|---|---|
| Unproven Package (0 stars, limited releases) | Audit codebase; build a wrapper layer to isolate Ozon logic. | High |
| Ozon API Changes | Subscribe to Ozon’s changelog; implement feature flags for breaking changes. | High |
| Performance Bottlenecks | Benchmark under load; use queues for async operations (e.g., inventory sync). | Medium |
| Missing Features | Extend the package or build a custom module (e.g., for webhooks). | Medium |
| PHP 8.4+ Dependency | Upgrade Laravel/PHP if needed; or fork the package for older versions. | Low |
OzonRateLimitExceeded)?ozon-api-php) with better adoption?Laravel Ecosystem:
OzonClient) as Laravel bindings. Override or extend in config/app.php:
'providers' => [
BaksDev\Ozon\OzonServiceProvider::class,
],
Ozon facade for concise API calls (e.g., Ozon::orders()->fetch()). Customize aliases:
'aliases' => [
'Ozon' => BaksDev\Ozon\Facades\Ozon::class,
],
.env:
php artisan vendor:publish --provider="BaksDev\Ozon\OzonServiceProvider" --tag="config"
Example .env:
OZON_CLIENT_ID=your_id
OZON_CLIENT_SECRET=your_secret
OZON_SANDBOX=true # Use sandbox for testing
OzonOrderCreated):
// Dispatch in package logic
event(new OzonOrderCreated($order));
// Listen in EventServiceProvider
protected $listen = [
OzonOrderCreated::class => [HandleOzonOrder::class],
];
config/http.php:
'timeout' => 30,
'retry' => [
'enabled' => true,
'max_attempts' => 3,
],
Database:
OzonOrder, OzonProduct). Example:
class OzonOrder extends Model {
protected $casts = [
'items' => 'array',
'created_at' => 'datetime',
];
}
ozon_orders). Example:
Schema::create('ozon_orders', function (Blueprint $table) {
$table->id();
$table->string('ozon_id');
$table->json('items');
$table->timestamps();
});
class SyncOzonInventory implements ShouldQueue {
public function handle() {
Ozon::products()->syncInventory();
}
}
Testing:
MockHttp to test API calls:
$this->mock(Http::class, function ($mock) {
$mock->shouldReceive('post')
->with('https://api.ozon.ru/orders', ['data' => $payload])
->andReturn(Http::response(['success' => true]));
});
php artisan test --group=ozon
Assessment (1–2 weeks):
Setup (1 week):
composer require baks-dev/ozon
php artisan vendor:publish --provider="BaksDev\Ozon\OzonServiceProvider" --tag="config"
php artisan migrate
.env with Ozon credentials.Core Integration (2–3 weeks):
Extensibility (Ongoing):
How can I help you explore Laravel packages today?