Skip to content

Extension and action examples

Use the action functions with records and Data objects supplied by your application. They pass each argument to the package operation and return its result.

These adapters show container registration. Use the owning package registry when a contract requires contributor discovery.

Contract adapters wrap an existing implementation. Call their registration function from your service provider with that implementation; tagged contracts keep their declared tag. Resolve the backend by its concrete class before registration so the replacement contract does not resolve itself. Static contract metadata uses one backend class per adapter.

<?php
declare(strict_types=1);
namespace App\CapellExamples\ShopifyCommerce;
function runIngestShopifyWebhook(\Capell\ShopifyCommerce\Models\ShopifyConnection $connection, string $topic, array $payload): void
{
\Capell\ShopifyCommerce\Actions\Webhooks\IngestShopifyWebhookAction::run($connection, $topic, $payload);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\ShopifyCommerce;
function runInstall(\Capell\Core\Data\PackageData $package, array $arguments = [], ?\Capell\Core\Contracts\ProgressReporter $reporter = null): void
{
\Capell\ShopifyCommerce\Actions\InstallShopifyCommercePackageAction::run($package, $arguments, $reporter);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\ShopifyCommerce;
function runPersistShopifyProduct(\Capell\ShopifyCommerce\Models\ShopifyConnection $connection, \Capell\ShopifyCommerce\Data\ShopifyProductData $product, \Carbon\CarbonInterface $syncedAt): \Capell\ShopifyCommerce\Models\ShopifyProduct
{
return \Capell\ShopifyCommerce\Actions\Catalog\PersistShopifyProductAction::run($connection, $product, $syncedAt);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\ShopifyCommerce;
function runPruneExpiredShopifyOAuthStates(): int
{
return \Capell\ShopifyCommerce\Actions\OAuth\PruneExpiredShopifyOAuthStatesAction::run();
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\ShopifyCommerce;
function runSyncShopifyCustomers(\Capell\ShopifyCommerce\Models\ShopifyConnection|int $connection): int
{
return \Capell\ShopifyCommerce\Actions\Customers\SyncShopifyCustomersAction::run($connection);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\ShopifyCommerce;
function runUpsertShopifyCustomer(\Capell\ShopifyCommerce\Models\ShopifyConnection $connection, array $snapshot): \Capell\ShopifyCommerce\Models\ShopifyCustomer
{
return \Capell\ShopifyCommerce\Actions\Customers\UpsertShopifyCustomerAction::run($connection, $snapshot);
}