This project is not covered by Drupal’s security advisory policy.

Config in Code (CINC) takes a code-first approach to Drupal configuration. CINC has no web interface, and does not export configuration to code, like Features or Configuration Management does. Instead, CINC assumes you're writing code to manage configuration and makes that as easy as possible. For an experienced developer, writing config with CINC should be faster than using the browser interfaces, though CINC is also a good starting point for writing your own browser interfaces.

CINC is built on a "CRUD" design, so all configuration can be Created, Read, Updated, and Deleted. Currently CINC can manage configuration for Content types, Fields, Views, Webforms, Beans, Field groups, Image styles, Date formats, Menus, Nodequeues, Text filters, WYSIWYG profiles, and more.

The PHP interface looks a lot like the configuration API in Drupal 8, with additional functionality to make things even easier. For example CINC_ContentType's ->add_field() method takes a CINC_Field object so field instance creation can be automated. And CINC_View makes adding a random sort as simple as ->add_sort('random').



 * Implements hook_enable().
function example_enable() {
  // Create a field
  $example_field = CINC::init('TextField')
    ->set_instance('label', 'Example Field')
  // Create a content type with a field.
    ->machine_name('example') // Display name is (optionally) auto-generated from type.
    ->set('title_label', 'Example Title')
  // Add a field to an existing content type.
    ->machine_name('example_exists') // Tells CINC which content type this is.
    ->add_field($example_field); // Field instance is auto-created like this.

 * Implements hook_disable().
function example_disable() {
  // Delete what we created.



The CINC YAML submodule allows configuration to be read directly from YAML files, just as they are in Drupal 8. This makes most configuration easily reusable between Drupal 8 and Drupal 7. This submodule currently requires the PHP YAML extension.


The CINC YAML Export submodule is a work in progress, a browser-based UI for exporting config to YAML files, which CINC YAML (or Drupal 8) can read.

Drupal 8 Plans

While CINC reproduces much of Drupal 8's configuration API in Drupal 7, it also adds useful functionality on top of that, so a Drupal 8 port will be created eventually. That's about as far as the plans go so far.

Get Involved

It's easy to add new CINC integrations for configuration not yet covered. Patches are welcome, but any module can also provide its own CINC implementations simply by subclassing CINC with a class name that starts with "CINC_", which CINC will automatically pick up. If you need any help using CINC, just open a support issue.

Supporting organizations: 

Project information