Drupal8 Theme Framework Standalone

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
dezofie's picture

Hi Guys,

Does any of you interested on having theme framework which can be used in any PHP development using Drupal Form API + Theme API? So imagine you have Silex framework with the power of Drupal theme. The first thinking you will have will be why and how? Let me explain in detail.

==Why==
I am from the backend developer point of view, which in HTML development, I only interested about:
- Give me HTML of table from notation that I familiar (Array object) and please handle the rest like assets
- Show me table with this data, and the HTML already have JS and other fancy features.

Which I looking around there is no such library/framework which help me fully on what I need. Well you may say that just use Twig. Yes, Twig is powerful and in fact I am using it. But it is very low level and you need to make everything from ground-up to have all the basic needs you need such as spit out button, label, textarea etc.

I have been using Drupal for such a long time since version 6. And I really appreciate the beauty and efforts of developers and you all on the contribution. The Form and Theme API is one of the core system in the Drupal that makes it shine. It is well-tested, rich and powerful. So comes to my mind, "hey, why dont I embrace this Drupal power into my custom PHP framework such as Silex, Wordpress, etc".

Because with only Array notation, Drupal is able to spit out any HTML accordingly. This is an example:
$output = ["#type"=>"label", "#title"=>"This is a beautiful label"];

// it will spit out based on the API
This is a beautiful label

==How==
The new Drupal 8 core system is nice. They changed a massive lots. New PHP classes (SICK!), Symfony integrations (awesome!) and the most important thing is, it uses Twig, the legendary theme framework.

With all reason I made decision to look around how to detach and break apart the Drupal framework so I only have the required components/codes for rendering the theme.

So what I did,
- I have my own DrupalKernel (/index.php, I called it RobKernel)
- I have my own Dependency Services (/core/core.services.yml)
- Remove unused components such as Database, we need to have real minimum requirements for this new framework to run. Because it is pain to have two database just to support your main site/framework and Drupal framework. (We could have SQLite to have the drupal run by itself without installing anything such as MySQL but lets have this as separate discussion)

I have it run as really basic proof-and-concept. I did download drupal8.0.0-beta7 put into folder core, delete all folders that I dont need (I assure you there is no modification to the core except the /core/core.service.yml, so I still abide the law of Drupal never hack core)

I call this new project as revere. Please clone and have a try in https://github.com/kororo/revere

Now this comes to open discussion questions:
- Is this my way ok? Or is there any easier way such as Symfony components http://symfony.com/components, to only import the subset of Drupal? Can we push this to the core Drupal for the idea?
- I cant rename the "core" folder and "site" structure placement, it seems Drupal always 100% assume user needs to have in this folder structure, which may cause issue on the code development for the main site. Is there any other way? Such as getting this framework as Composer and we can have one single main class to render the HTML.
- The footprint of having this is quite large, it takes around 16MB to have this up and running. Is there any way we could reduce it?

I am new here so please shoot me any suggestions if I missed anything from this discussion.

Thanks
Rob

Theme development

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: