What is Koselig?
Koselig is the result of my year of working at a web development agency (Motionlab) working on WordPress sites and day-in day-out thinking "it's got to get better than this." And now it has! Koselig is going to make you love your life as a WordPress developer (well...) by allowing you to write pure Laravel code but keep that all-too-familiar WordPress dashboard your customers seem to love and you love to hate.
Unlike frameworks such as Themosis which are essentially WordPress theme frameworks with Blade & a few Illuminate components, Koselig completely revolutionises the WordPress developer experience by running WordPress on Laravel. WordPress' cogs are still turning in the background but with its head cut off, it has a "no-op" theme that renders nothing. Koselig will get the page that WordPress thought it was loading and match it to a Route that you define and invokes your controller. From that point on the Laravel application is free to call any WordPress method you can when developing a native WordPress theme.
Since we have the pleasure of working in a Laravel environment, we can start swapping out those imfamously slow WordPress components with beautiful Laravel ones (so far this has only been mail, database & caching) and providing nice interfaces to interact with WordPress.
Route::template('promo', function (Post $page) {
return view('promo', [
'page' => $page,
'content' => $page->getAcf('content')
]);
});
<h1>{{ $page->title }}</h1>
<time datetime="{{ $page->post_date->format('c') }}">{{ $page->post_date->diffForHumans() }}</time>
By <a href="{{ $page->author->link() }}" rel="author">{{ $page->author->display_name }}</a>
@forelse($content as $block)
@if($block['acf_layout'] === 'paragraph')
<p>{{ $block['text'] }}</p>
@elseif($block['acf_layout'] === 'download')
<a href="{{ $block['file'] }}">{{ $block['content'] }}</a>
@endif
@empty
<h1>No blocks!</h1>
@endforelse
You can use all your regular WordPress plugins and all your regular Laravel plugins (Debugbar is amazing and shows your WordPress queries/auth status/etc too) with minimal problems. Please don't be scared to dive into the library code and fix what you need to fix to get it working, the codebase is pretty small and easy to wrap your head around!