PHP code example of develate / blogframe

1. Go to this page and download the library: Download develate/blogframe 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/ */

    

develate / blogframe example snippets


use Develate\Blogframe\Facades\Blogframe;

$articles = Blogframe::all('de');
$article = Blogframe::find(22, 'de');
$article = Blogframe::findOrFail(22, 'de');

$article->id;
$article->name;
$article->language;
$article->title;
$article->image;
$article->imageUrl;
$article->imageSrcset;
$article->imageSizes;
$article->attributes;
$article->markdown;
$article->html;
$article->sourcePath;

$description = $article->attribute('description');
$html = $article->toHtml();

$originalUrl = Blogframe::imageUrl('1.png');
$srcset = Blogframe::imageSrcset('1.png');

namespace App\Providers;

use App\Markdown\CalloutTag;
use Develate\Blogframe\Facades\Blogframe;
use Illuminate\Support\ServiceProvider;

final class AppServiceProvider extends ServiceProvider
{
    public function boot(): void
    {
        Blogframe::customtag(new CalloutTag());
    }
}

Blogframe::customtag(new FirstCalloutTag());  // identifier: callout
Blogframe::customtag(new NewCalloutTag());    // replaces FirstCalloutTag

use Intervention\Image\Drivers\Gd\Driver;

return [
    'paths' => [
        'articles' => resource_path('blog/articles'),
        'images' => resource_path('blog/images'),
    ],

    'languages' => [
        'default' => null,  // app locale
        'fallback' => null, // app fallback locale
    ],

    'commonmark' => [
        'options' => [
            'html_input' => 'strip',
            'allow_unsafe_links' => false,
        ],
        'extensions' => [],
    ],

    'images' => [
        'serve' => true,
        'base_url' => null,
        'route_prefix' => 'blogframe/images',
        'middleware' => [],
        'allowed_extensions' => ['png', 'jpg', 'jpeg', 'webp', 'gif', 'avif'],
        'widths' => [320, 640, 960, 1280, 1600],
        'fallback_width' => 960,
        'sizes' => '100vw',
        'driver' => Driver::class,
        'quality' => 82,
        'cache_path' => storage_path('framework/cache/blogframe/images'),
        'cache_control' => 'public, max-age=31536000, immutable',
    ],
];

'images' => [
    'serve' => false,
    'base_url' => 'https://cdn.example.com/blog',
    // ...
],
bash
php artisan vendor:publish --tag=blogframe-config