Back to Home

Moving KodiCMS from the Kohana framework to Laravel 5 / KodiCMS Blog

php · cms · laravel 5 · kodicms

KodiCMS move from Kohana framework to Laravel 5



    When writing articles on Habré, I noticed that many did not like the deceased Kohana framework, and I heard a lot of criticism of the project for this reason and thought about the question: “ What to do and what to do with Kohana? ”, Because the framework is completely not conducive to the development of CMS throughout the year.

    My first thoughts were about continuing the development of Kohana on my own. First, Composer was integrated into the system, the modules and plugins migrated to the packages in the https://packagist.org/packages/kodicms/ repository and the package types https://github.com/composer/installers were added to the composer installer . After spending some time searching, I came across a Kohana54 project ( https://github.com/kohana54/core), the developer of which decided to bring all classes in line with the PSR-4 standard but apparently left it until better times. At first, it didn’t bother me much, I could try to finish for it, but a few days later I realized that in addition to the kernel itself, I would also have to rewrite the rest of the standard framework modules, as well as all the CMS modules, which is equivalent to using another, more modern framework and decided to finally tie with Kohana.

    The question arose: “Which framework should I choose?”


    • Laravel
    • FuelPHP
    • Symfony
    • Yii2
    • Zend framework 2
    • Cakephp

    Comparison of frameworks can draw on an entire article, so I will limit myself only to my choice, Laravel framework, which intrigued me:

    • its simplicity and less logical application structure,
    • excellent architecture, which could be modified to fit your needs,
    • the presence of a bunch of opportunities out of the box that could help in implementing part of the portable functionality,
    • convenient console
    • convenient database tools (migration, seeding),
    • an active, vibrant community
    • Well and most importantly, the framework is actively developing, which, as I noted in my project, is very important.

    For many people, April 1 is associated with a laugh day, and for me, the birthday of a new project - KodiCMS on the laravel framework. It was on this day that a new repository https://github.com/KodiCMS/kodicms-laravel was created and the first commit was added to it.

    I’ll talk a little about the structure of the new CMS. Many people know that Laravel out of the box does not have a modular structure, and packages are not the same as modules, so the first thing that was written was ModuleLoader , which helped with the organization of the modular structure and the dynamic connection of modules, simply indicating its name in the config.

    As a result, the structure of the module has the following form


    • config - application configs, can be overwritten from the folder/config/
      • permissions.php - Used to specify a list of rights
      • sitemap.php - Used to specify pages for the admin panel menu
      • behaviors.php
    • Console
      • Commands - Console Command File Location
    • database
      • migrations - migration files will be launched by the commandcms:modules:migrate
      • seeds
        • DatabaseSeeder.php - if it exists, it will be launched by the commandcms:modules:seed
    • Helpers - helper module classes
    • Http
      • Controllers - module controllers
      • Middleware
      • routes.php - routes of the current module, wrapped in namespaceKodiCMS\{module}
    • Observers - Observers for Eloquent Models
    • Providers
      • ModuleServiceProvider.php - Service provider (inherited from KodiCMS\CMS\Providers\ServiceProvider), if any, will be launched at the time of application initialization
    • resources
      • js - JavaScript files, in this folder, js files are searched for on virtual paths/backend/cms/js/{script.js}
      • lang - Translation files for the module, accessible by the lowercase key of the module nametrans('{module}::file.key')
      • views - Module templates, accessible by the lowercase key of the module nameview('{module}::template')
      • packages.php - In this file you can connect your Assets (Media) packages
    • Services - Service Containers
    • ModuleContainer.php - If this file exists, it will be included as a system file of the module, which indicates the relative paths and actions at the time of initialization. Must inherit fromKodiCMS\CMS\Loader\ModuleContainer

    You can read more about modularity here.

    By analogy with the modules, it is planned to connect third-party plug-ins with the only difference that they will be activated through the administrative interface with the ability to download them from the repository.

    As they say, the eyes are afraid, and the hands are doing. After the implementation of the modular structure, the procedure of transferring standard modules of the system and the implementation of the main features began. And at the moment, according to my estimates, just over 60% of the functionality has been transferred:

    • Adding a modular structure to Laravel
    • System kernel transfer
    • Migrating the API Module
    • Migrating the elFinder module
    • Migrating the Pages module
    • Migrating the Layouts module
    • Migrate Snippets
    • Migrate Email Module
    • Migrate the Cron jobs module
    • Migrating the Widgets Module
    • Migrate Dashboard
    • Migrating the Users, Roles module
    • ACL Module Migration
    • Migrating the Datasource Module
    • Migrating the Hyrid plugin and integrating it with advanced functionality
    • Implementation of the system installer
    • Implementing plug-ins with a structure similar to modules

    It was originally planned to transfer all the functionality in at least 6 months, but something went wrong and the process went faster ... Developers from the VK group http://vk.com/laravel_rus and the LaravelRUS channel became interested in the system , after which enthusiasts began to offer assistance in developing the project of one of the coolest OpenSource CMS on one of the coolest frameworks.

    Why do we need another CMS ?!


    When using different CMS, I often came across the fact that many of them offer the same functionality but with slight differences. Those. in fact, many CMS drive the user into a certain framework, whether it’s the structure of the URL or the placement of content on the pages of the site. Many of them have a self-written core, which is either difficult to expand, or it takes a long time to study the documentation in order to start developing.

    When writing my CMS, I wanted to collect all the best from them and combine them into one. To begin with, I decided to use one of the popular frameworks and make minimum changes to the kernel so that any developer can enter the development process in the shortest possible time. In addition, I do not want a CMS like everyone else, only with my name, my goal is to make some kind of constructor in which you can design your own sections (blog, news, etc.) by adding fields of the required types to them through the admin panel, which not hard coded into the system code, but added using plugins by third-party developers. The same is true with the output of content to the pages of the site. So that each user without special knowledge in programming and picking site templates can display the necessary data, whether it is a list of documents or a site menu or plain HTML.

    The ideas of the sea system and all of them are realizable and most of them have already been implemented. Some of them may need further development. But everything as usual rests on developers. Therefore, we invite everyone to join the development, especially since it will help to increase your experience in working with the Laravel framework, as well as to use your experience in the future.

    As usual, you can always see the result of work:


    Website: http://laravel.kodicms.ru/backend

    oror download and install locally https://github.com/KodiCMS/kodicms-laravel

    Acknowledgments


    Thanks to KodiCMS, I discovered the world of good services and people who are ready to provide my help:

    Ps In the near future, the first online meeting to discuss the project will be held, which will tell in more detail about the system, its history and the current status of https://vk.com/kodicms?w=wall-48395169_287%2Fall

    Upd. At the moment, the system still has the status of the Alpha version and errors may occur or shortcomings that will be subsequently eliminated. Bug reports are welcome.

    Read Next