alphalemon/alphalemon-cms-bundle
Since AlphaLemon CMS is built for Symfony2, direct Laravel integration is not natively supported. However, you can leverage its core features (Propel ORM, theming, and CMS logic) by:
Installing Propel in Laravel
composer require propel/propel1 propel/propel-bundle
Configure Propel in config/app.php and run migrations:
php artisan propel:build --all
php artisan propel:migrate
Extracting AlphaLemon’s Core Logic
src/AlphaLemon/CmsBundle/ for Propel schemas (schema.xml).src/AlphaLemon/ThemeEngineBundle/ for templating logic.php artisan make:model Page -m --propel
First Use Case: Basic CMS Page Management
Page model with Propel behaviors (e.g., VersionableBehavior).// app/Http/Controllers/Admin/PagesController.php
public function index() {
$pages = PageQuery::create()->find();
return view('admin.pages.index', compact('pages'));
}
Schema Inheritance: AlphaLemon uses Propel’s XML schemas. Convert these to Laravel migrations:
<!-- AlphaLemon schema.xml snippet -->
<table name="alcms_page" phpName="Page">
<column name="title" type="VARCHAR" size="255" required="true" />
<behavior name="versionable" />
</table>
→ Laravel migration:
Schema::create('pages', function (Blueprint $table) {
$table->string('title')->unique();
$table->timestamps();
// Add Propel versioning columns manually if needed
});
Query Patterns:
// AlphaLemon-style query (Propel)
$pages = PageQuery::create()
->filterByPublished(true)
->orderByTitle()
->find();
// Laravel equivalent (Eloquent)
$pages = Page::where('published', true)->orderBy('title')->get();
// app/Services/ThemeService.php
public function render($theme, $blocks) {
return view("themes.$theme.layout", compact('blocks'));
}
resources/themes/ and use Blade templates.Reuse AlphaLemon’s UI Components:
// AlphaLemon (Symfony)
$form = $this->createForm(new PageType(), $page);
// Laravel
use Illuminate\Support\Facades\Validator;
$validator = Validator::make($request->all(), [
'title' => 'required|string',
]);
CRUD Boilerplate: Use Laravel’s generators to mirror AlphaLemon’s admin structure:
php artisan make:controller Admin/PagesController --resource --model=Page
spatie/laravel-medialibrary:
// AlphaLemon (Symfony)
$finder = $this->get('elfinder')->getFinder();
// Laravel
use Spatie\MediaLibrary\HasMedia;
class Page extends Model implements HasMedia {
public function registerMediaCollections(): void {
$this->addMediaCollection('images');
}
}
VersionableBehavior requires manual column setup in Laravel:
Schema::create('pages', function (Blueprint $table) {
$table->string('title');
$table->integer('version')->default(1); // Add this!
$table->json('version_data'); // For storing revisions
});
willdurand/propel-typehintable-behavior for better IDE support in Laravel.Twig_Environment. In Laravel:
View facade:
public function render($theme, $blocks) {
return view("themes.$theme.layout", compact('blocks'))
->render();
}
// webpack.mix.js
mix.setPublicPath('public/themes')
.js('resources/themes/js/app.js', 'js')
.sass('resources/themes/scss/app.scss', 'css');
routing.yml. Convert to Laravel:
# AlphaLemon routing.yml
alcms_backend:
resource: "@AlphaLemonCmsBundle/Resources/config/routing.yml"
prefix: /backend
→ Laravel routes/web.php:
Route::prefix('backend')->name('alcms.')->group(function () {
Route::resource('pages', \App\Http\Controllers\Admin\PagesController::class);
});
Route::middleware(['auth', 'admin'])->group(function () {
// Admin routes
});
alcms_dev.php) won’t work directly. Instead:
config/propel.php:
'logging' => [
'enabled' => true,
'level' => 'debug',
],
storage/logs/propel.log.<column name="meta_title" type="VARCHAR" size="255" />
class Page extends Model {
protected $fillable = ['meta_title'];
}
with() for eager loading:
$pages = Page::with('author', 'media')->get();
PageQuery::create()->enableBatchMode()->find();
How can I help you explore Laravel packages today?