Installation Add the package via Composer:
composer require apie/cms-layout-graphite
Publish the configuration (if available):
php artisan vendor:publish --provider="Apie\CmsLayoutGraphite\CmsLayoutGraphiteServiceProvider"
First Use Case
The package appears to be a CMS layout system (likely for Graphite CMS). Start by inspecting the config/cms-layout-graphite.php (if published) to understand available layout types, blocks, or regions. Example usage might involve:
use Apie\CmsLayoutGraphite\Facades\CmsLayoutGraphite;
// Fetch a layout by ID or slug
$layout = CmsLayoutGraphite::getLayout('homepage');
// Render a layout (if the package supports direct rendering)
echo $layout->render();
Where to Look First
CmsLayoutGraphiteServiceProvider for registered bindings.CmsLayoutGraphite facade for convenience.Layout Management
CmsLayoutGraphite::find($id)).$layout->addRegion('header', $block);
$layout->getRegion('footer')->render();
CmsLayoutGraphite::cacheLayout($layout, 3600)).Integration with Graphite CMS
graphite.content.updated) to refresh layouts:
event(new \Graphite\Events\ContentUpdated($content));
@layout('graphite::layouts.app')
@section('content')
{{ $layout->renderRegion('main') }}
@endsection
Laravel Service Integration
public function handle(Request $request, Closure $next) {
$request->merge(['layout' => CmsLayoutGraphite::getLayout($request->route('slug'))]);
return $next($request);
}
View::composer('*', function ($view) {
$view->with('layout', CmsLayoutGraphite::getCurrentLayout());
});
API Responses
return response()->json([
'layout' => CmsLayoutGraphite::getLayout('api')->toArray(),
]);
Lack of Documentation
tests/ folders for usage patterns.CmsLayoutGraphite in the monorepo to find real-world implementations.Graphite CMS Dependency
composer.json:
"require": {
"graphite/graphite": "^1.0"
}
Configuration Quirks
config/cms-layout-graphite.php is unpublishable, hardcode defaults:
config(['cms-layout-graphite.default_driver' => 'graphite']);
graphite, database). Test all drivers in your environment.Caching Gotchas
Cache::tags(['layout-homepage'])->forget('homepage-layout');
Log Layout Data Use Laravel’s logging to inspect layout structures:
\Log::debug('Layout regions:', $layout->getRegions());
Enable Query Logging If layouts query Graphite CMS, enable debug mode:
\Graphite::setDebug(true);
Check for Deprecated Methods The package may use internal Apie methods. Override or extend the package:
// app/Providers/CmsLayoutGraphiteServiceProvider.php
public function register() {
$this->app->extend('cms-layout-graphite', function ($service) {
return new CustomCmsLayoutGraphite($service);
});
}
Custom Layout Drivers
Implement a new driver by extending Apie\CmsLayoutGraphite\Contracts\Driver:
class DatabaseDriver implements Driver {
public function getLayout($id) {
return DB::table('layouts')->find($id);
}
}
Block System Extensions Extend the block system to support custom types:
CmsLayoutGraphite::extendBlock('video', function ($block) {
return new VideoBlock($block->content);
});
Event Listeners Listen for layout events (if supported) to react to changes:
CmsLayoutGraphite::listen('layout.updated', function ($layout) {
// Send notification or update cache
});
Blade Directives Create custom Blade directives for layouts:
Blade::directive('layoutRegion', function ($region) {
return "<?php echo \\Apie\\CmsLayoutGraphite\\Facades\\CmsLayoutGraphite::renderRegion($region); ?>";
});
Usage:
@layoutRegion('sidebar')
How can I help you explore Laravel packages today?