Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Other Test Laravel Package

aliznettest/other-test

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation Add the package via Composer:

    composer require aliznet/akeneo-websphere-connector
    

    Note: Ensure your Laravel project meets the PHP 5.4+ requirement (though Laravel 5+ typically uses PHP 7.4+; verify compatibility).

  2. Configuration Locate the config/akeneo_websphere.php file (auto-generated or manually created). Configure:

    'websphere' => [
        'host' => env('WEBSPHERE_HOST', 'localhost'),
        'port' => env('WEBSPHERE_PORT', 80),
        'username' => env('WEBSPHERE_USERNAME', 'admin'),
        'password' => env('WEBSPHERE_PASSWORD', ''),
        'timeout' => 30,
    ],
    

    Publish the config if needed:

    php artisan vendor:publish --provider="Aliznet\AkeneoWebsphereConnector\AkeneoWebsphereConnectorServiceProvider"
    
  3. First Use Case: Sync Product Data Use the connector to fetch a product from Websphere Commerce (WCS) and map it to Akeneo PIM:

    use Aliznet\AkeneoWebsphereConnector\Services\WebsphereConnector;
    
    $connector = app(WebsphereConnector::class);
    $product = $connector->getProductById('12345');
    
    // Transform and save to Akeneo (custom logic required)
    

Implementation Patterns

Workflow: Product Data Sync

  1. Fetch Products Retrieve products from WCS in batches:

    $products = $connector->getProducts(['limit' => 50, 'offset' => 0]);
    
  2. Transform Data Use Laravel’s service container to bind a custom transformer:

    $this->app->bind(WcsToAkeneoTransformer::class, function ($app) {
        return new WcsToAkeneoTransformer($app->make(WebsphereConnector::class));
    });
    

    Example transformer:

    class WcsToAkeneoTransformer {
        public function transform(array $wcsProduct): array {
            return [
                'sku' => $wcsProduct['sku'],
                'family' => 'electronics',
                'attributes' => [
                    'name' => $wcsProduct['name'],
                    'price' => $wcsProduct['price']['value'],
                ],
            ];
        }
    }
    
  3. Queue Sync Jobs Offload sync to a queue (e.g., sync-wcs-products job):

    SyncWcsProducts::dispatch($products)->onQueue('akeneo');
    

Integration Tips

  • Akeneo API Client Use akeneo/pim-community-dev to push transformed data:

    $akeneoClient = new AkeneoClient([
        'client_id' => env('AKENEO_CLIENT_ID'),
        'secret' => env('AKENEO_SECRET'),
        'endpoint' => env('AKENEO_ENDPOINT'),
    ]);
    $akeneoClient->createProduct($transformedProduct);
    
  • Event-Driven Sync Trigger syncs via Akeneo events (e.g., ProductCreatedEvent):

    AkeneoProductCreated::dispatch($akeneoProduct)
        ->then(function () {
            SyncWcsProduct::dispatch($akeneoProduct->getSku());
        });
    
  • Laravel Scheduler Schedule daily syncs in app/Console/Kernel.php:

    $schedule->job(new SyncWcsProducts)->daily();
    

Gotchas and Tips

Pitfalls

  1. Deprecated Symfony 2.7 The package requires Symfony 2.7, which may conflict with Laravel’s modern stack. Test thoroughly or fork the package to update dependencies.

  2. No Laravel-Specific Features The package lacks Laravel-specific helpers (e.g., Eloquent models, queues). Expect to build abstractions.

  3. Authentication Quirks WCS may require SOAP headers or tokens. Extend the connector:

    $connector->setAuthHeader('X-Auth-Token', env('WCS_TOKEN'));
    
  4. Rate Limiting WCS APIs often throttle requests. Implement exponential backoff in your sync logic:

    try {
        $response = $connector->getProducts();
    } catch (RateLimitException $e) {
        sleep($e->getRetryAfter());
        retry();
    }
    

Debugging

  • Enable Verbose Logging Configure Monolog in config/logging.php to log WCS requests:

    'channels' => [
        'websphere' => [
            'driver' => 'single',
            'path' => storage_path('logs/websphere.log'),
            'level' => 'debug',
        ],
    ],
    

    Then log requests in the connector:

    \Log::channel('websphere')->debug('WCS Request:', ['data' => $requestData]);
    
  • Mock WCS for Testing Use Laravel’s HTTP client to mock responses:

    $this->partialMock(WebsphereConnector::class, function ($mock) {
        $mock->shouldReceive('getProductById')
             ->andReturn(['sku' => 'test', 'name' => 'Test Product']);
    });
    

Extension Points

  1. Custom Endpoints Extend the connector to support non-standard WCS endpoints:

    class CustomWebsphereConnector extends WebsphereConnector {
        public function getInventory($storeId) {
            return $this->callSoapMethod('getInventory', ['storeId' => $storeId]);
        }
    }
    
  2. Webhook Listeners Listen for WCS webhook events (e.g., ProductUpdated) and trigger Akeneo syncs:

    use Aliznet\AkeneoWebsphereConnector\Events\WcsProductUpdated;
    
    WcsProductUpdated::listen(function ($event) {
        SyncWcsProduct::dispatch($event->getSku());
    });
    
  3. Caching Cache WCS responses to reduce API calls:

    $products = Cache::remember("wcs_products_{$offset}", now()->addHours(1), function () use ($connector, $offset) {
        return $connector->getProducts(['offset' => $offset]);
    });
    
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky