PHP code example of ozankurt / laravel-modules-blog
1. Go to this page and download the library: Download ozankurt/laravel-modules-blog 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/ */
ozankurt / laravel-modules-blog example snippets
$related = $post->related(); // Collection<Post>, up to 5
$related = $post->related(10); // widen the limit
// Or compose from the underlying scope (adds `shared_tags` /
// `shared_category` ordering columns), e.g. with eager loads:
Post::relatedTo($post)->with('category')->limit(3)->get();
use Kurt\Modules\Blog\Support\FeedBuilder;
// In the consuming app's routes:
Route::get('feed', fn () => response(
FeedBuilder::make()->limit(20)->toRss(),
200,
['Content-Type' => 'application/rss+xml; charset=UTF-8'],
));
// Per-category feed, custom item URLs and channel metadata:
FeedBuilder::make()
->forCategory($category)
->title('My Blog')
->link(url('/'))
->linkUsing(fn ($post) => route('posts.show', $post->slug))
->toRss();
use Kurt\Modules\Blog\Support\SitemapBuilder;
$entries = SitemapBuilder::make()
-> // Collection<SitemapEntry>
$rows = SitemapBuilder::make()->toArray(); // array of loc/lastmod/... rows
'http' => [
'mode' => env('BLOG_HTTP_MODE', 'headless'), // headless | api | ui
'prefix' => 'api/blog', // URL prefix for every route
'middleware' => ['api'], // base middleware (all routes)
'auth_middleware' => ['auth'], // added to write routes; e.g. ['auth:sanctum']
'rate_limit' => '60,1', // maxAttempts,decayMinutes for throttle:blog-api
],
use Filament\Panel;
use Kurt\Modules\Blog\Filament\BlogPlugin;
public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugin(BlogPlugin::make());
}