# Worked extension examples

These developer-facing recipes are kept beside the package contract. Replace the example values with the site-specific records and data objects used by the calling workflow.

<!-- example: contract Capell\FrontendOptimizer\Contracts\CriticalCssGenerator -->

```php
<?php
declare(strict_types=1);
final class ExampleCriticalCssGeneratorImplementation implements \Capell\FrontendOptimizer\Contracts\CriticalCssGenerator
{
    public function generate(\Capell\FrontendOptimizer\Models\FrontendCriticalCssArtifact $artifact): string
    {
        throw new LogicException('Implement this package contract for the calling site.');
    }
}

app()->bind(\Capell\FrontendOptimizer\Contracts\CriticalCssGenerator::class, ExampleCriticalCssGeneratorImplementation::class);
```

<!-- example: contract Capell\FrontendOptimizer\Contracts\OptimizingFrontendResourcePlanRenderer -->

```php
<?php
declare(strict_types=1);
final class ExampleOptimizingFrontendResourcePlanRendererImplementation implements \Capell\FrontendOptimizer\Contracts\OptimizingFrontendResourcePlanRenderer
{
    public function __construct()
    {
        return;
    }
}

app()->bind(\Capell\FrontendOptimizer\Contracts\OptimizingFrontendResourcePlanRenderer::class, ExampleOptimizingFrontendResourcePlanRendererImplementation::class);
```

<!-- example: contract Capell\FrontendOptimizer\Contracts\RouteRenderShapeProvider -->

```php
<?php
declare(strict_types=1);
final class ExampleRouteRenderShapeProviderImplementation implements \Capell\FrontendOptimizer\Contracts\RouteRenderShapeProvider
{
    /** @return list<RouteRenderShapeData> */
    public function shapes(): array
    {
        throw new LogicException('Implement this package contract for the calling site.');
    }
}

app()->bind(\Capell\FrontendOptimizer\Contracts\RouteRenderShapeProvider::class, ExampleRouteRenderShapeProviderImplementation::class);
```