drupal
Verbatim mirror of the git.drupal.org repository for Drupal core. Please see the https://github.com/drupal/drupal#contributing. PRs are not accepted on GitHub.
Top Related Projects
WordPress, Git-ified. This repository is just a mirror of the WordPress subversion repository. Please do not send pull requests. Submit pull requests to https://github.com/WordPress/wordpress-develop and patches to https://core.trac.wordpress.org/ instead.
Home of the Joomla! Content Management System
The TYPO3 Core - Enterprise Content Management System. Synchronized mirror of https://review.typo3.org/q/project:Packages/TYPO3.CMS
Self-hosted CMS platform based on the Laravel PHP Framework.
Quick Overview
Drupal is an open-source content management system (CMS) and web application framework written in PHP. It provides a flexible and powerful platform for building websites, web applications, and digital experiences. Drupal is known for its modularity, extensibility, and strong community support.
Pros
- Highly customizable and flexible, allowing for the creation of complex websites and applications
- Large and active community, providing extensive support, documentation, and contributed modules
- Strong security features and regular updates to address vulnerabilities
- Scalable architecture suitable for small websites to large enterprise applications
Cons
- Steep learning curve for beginners, especially compared to some other CMS platforms
- Can be resource-intensive, potentially requiring more server resources than simpler CMS options
- Upgrading between major versions can be complex and time-consuming
- Some developers find the codebase and architecture overly complex for simpler projects
Code Examples
- Creating a custom module:
<?php
/**
* @file
* Contains example_module.module.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function example_module_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.example_module':
return '<p>' . t('This is an example module.') . '</p>';
}
}
- Defining a custom route:
<?php
namespace Drupal\example_module\Controller;
use Drupal\Core\Controller\ControllerBase;
class ExampleController extends ControllerBase {
public function content() {
return [
'#type' => 'markup',
'#markup' => $this->t('Hello, World!'),
];
}
}
- Creating a custom form:
<?php
namespace Drupal\example_module\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
class ExampleForm extends FormBase {
public function getFormId() {
return 'example_form';
}
public function buildForm(array $form, FormStateInterface $form_state) {
$form['name'] = [
'#type' => 'textfield',
'#title' => $this->t('Name'),
'#required' => TRUE,
];
$form['submit'] = [
'#type' => 'submit',
'#value' => $this->t('Submit'),
];
return $form;
}
public function submitForm(array &$form, FormStateInterface $form_state) {
$name = $form_state->getValue('name');
\Drupal::messenger()->addMessage($this->t('Hello, @name!', ['@name' => $name]));
}
}
Getting Started
To get started with Drupal development:
- Install Composer:
curl -sS https://getcomposer.org/installer | php
- Create a new Drupal project:
composer create-project drupal/recommended-project my_site_name_dir
- Navigate to the project directory:
cd my_site_name_dir
- Install Drush (Drupal CLI):
composer require drush/drush
- Start a local PHP server:
php -S localhost:8000 -t web/
- Visit
http://localhost:8000
in your browser to complete the Drupal installation
For more detailed instructions, refer to the official Drupal documentation.
Competitor Comparisons
WordPress, Git-ified. This repository is just a mirror of the WordPress subversion repository. Please do not send pull requests. Submit pull requests to https://github.com/WordPress/wordpress-develop and patches to https://core.trac.wordpress.org/ instead.
Pros of WordPress
- Easier to use and set up for beginners
- Larger ecosystem of themes and plugins
- More widespread adoption and community support
Cons of WordPress
- Less flexible for complex, custom web applications
- Potentially more vulnerable to security issues due to popularity
- Can be slower and less efficient for large-scale sites
Code Comparison
WordPress (functions.php):
function enqueue_custom_scripts() {
wp_enqueue_script('custom-script', get_template_directory_uri() . '/js/custom.js', array('jquery'), '1.0', true);
}
add_action('wp_enqueue_scripts', 'enqueue_custom_scripts');
Drupal (mytheme.libraries.yml):
global-styling:
css:
theme:
css/style.css: {}
js:
js/script.js: {}
dependencies:
- core/jquery
WordPress uses a function-based approach for adding scripts, while Drupal uses a YAML configuration file. This reflects the different architectures and philosophies of the two CMSs. WordPress focuses on simplicity and ease of use, while Drupal emphasizes modularity and configuration-driven development.
Home of the Joomla! Content Management System
Pros of Joomla
- Easier learning curve for beginners
- More flexible content organization with categories and tags
- Larger selection of free extensions and templates
Cons of Joomla
- Less scalable for large, complex websites
- Slower performance, especially with many extensions installed
- Less robust security features and update processes
Code Comparison
Joomla (PHP):
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
$app = Factory::getApplication();
$doc = $app->getDocument();
Drupal (PHP):
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function example_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.example':
return '<p>' . t('Example module help text.') . '</p>';
}
}
Both Joomla and Drupal are popular open-source content management systems (CMS) written in PHP. Joomla tends to be more user-friendly for beginners, while Drupal offers more advanced features and scalability for larger projects. The code examples showcase differences in their approach to routing and application structure.
The TYPO3 Core - Enterprise Content Management System. Synchronized mirror of https://review.typo3.org/q/project:Packages/TYPO3.CMS
Pros of TYPO3
- More flexible and customizable backend interface
- Better support for multilingual websites out of the box
- Stronger enterprise-level features and scalability
Cons of TYPO3
- Steeper learning curve for developers and content editors
- Smaller community and ecosystem compared to Drupal
- Less frequent release cycles and updates
Code Comparison
TYPO3 (PHP):
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
$result = $queryBuilder
->select('uid', 'title')
->from('pages')
->where(
$queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT))
)
->execute();
Drupal (PHP):
$query = \Drupal::entityQuery('node')
->condition('status', 1)
->condition('type', 'article')
->sort('created', 'DESC')
->range(0, 10);
$nids = $query->execute();
Both TYPO3 and Drupal are powerful content management systems with their own strengths. TYPO3 excels in enterprise environments and complex multilingual setups, while Drupal offers a larger community and more frequent updates. The code examples showcase different approaches to database queries, with TYPO3 using a query builder and Drupal leveraging its entity query system.
Self-hosted CMS platform based on the Laravel PHP Framework.
Pros of October
- Lighter weight and easier to learn than Drupal
- More modern PHP architecture using Laravel framework
- Simpler theming system with Twig templating
Cons of October
- Smaller ecosystem and community compared to Drupal
- Less enterprise-level features out of the box
- Fewer available modules/plugins than Drupal's extensive library
Code Comparison
October CMS (theme file):
{% partial 'header' %}
<h1>{{ post.title }}</h1>
{{ post.content|raw }}
{% partial 'footer' %}
Drupal (theme file):
<?php
function mytheme_preprocess_node(&$variables) {
$variables['title'] = $variables['node']->getTitle();
$variables['content'] = $variables['node']->getContent();
}
?>
October uses a more straightforward Twig templating system, while Drupal relies on PHP preprocessing functions for theming. October's approach is generally considered more beginner-friendly and easier to read, but Drupal's method offers more flexibility for complex customizations.
Both CMSs have their strengths, with October focusing on simplicity and modern architecture, while Drupal excels in scalability and enterprise features. The choice between them depends on project requirements and developer preferences.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Drupal is an open source content management platform supporting a variety of websites ranging from personal weblogs to large community-driven websites. For more information, visit the Drupal website, Drupal.org, and join the Drupal community.
Contributing
Drupal is developed on Drupal.org, the home of the international Drupal community since 2001!
Drupal.org hosts Drupal's GitLab repository, its issue queue, and its documentation. Before you start working on code, be sure to search the issue queue and create an issue if your aren't able to find an existing issue.
Every issue on Drupal.org automatically creates a new community-accessible fork that you can contribute to. Learn more about the code contribution process on the Issue forks & merge requests page.
Usage
For a brief introduction, see USAGE.txt. You can also find guides, API references, and more by visiting Drupal's documentation page.
You can quickly extend Drupal's core feature set by installing any of its thousands of free and open source modules. With Drupal and its module ecosystem, you can often build most or all of what your project needs before writing a single line of code.
Changelog
Drupal keeps detailed change records. You can search Drupal's changes for a record of every notable breaking change and new feature since 2011.
Security
For a list of security announcements, see the Security advisories page (available as an RSS feed). This page also describes how to subscribe to these announcements via email.
For information about the Drupal security process, or to find out how to report a potential security issue to the Drupal security team, see the Security team page.
Need a helping hand?
Visit the Support page or browse over a thousand Drupal providers offering design, strategy, development, and hosting services.
Legal matters
Know your rights when using Drupal by reading Drupal core's license.
Learn about the Drupal trademark and logo policy here.
Top Related Projects
WordPress, Git-ified. This repository is just a mirror of the WordPress subversion repository. Please do not send pull requests. Submit pull requests to https://github.com/WordPress/wordpress-develop and patches to https://core.trac.wordpress.org/ instead.
Home of the Joomla! Content Management System
The TYPO3 Core - Enterprise Content Management System. Synchronized mirror of https://review.typo3.org/q/project:Packages/TYPO3.CMS
Self-hosted CMS platform based on the Laravel PHP Framework.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot