PHP code example of spatie / laravel-url-ai-transformer

1. Go to this page and download the library: Download spatie/laravel-url-ai-transformer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

spatie / laravel-url-ai-transformer example snippets


use Spatie\LaravelUrlAiTransformer\Support\Transform;
use Spatie\LaravelUrlAiTransformer\Transformers\LdJsonTransformer;

Transform::urls('https://example.com/blog/my-post')
    ->usingTransformers(new LdJsonTransformer);

use Spatie\LaravelUrlAiTransformer\Models\TransformationResult;

$structuredData = TransformationResult::forUrl('https://example.com/blog/my-post','ldJson'
);
bash
php artisan transform-urls