SlideShare a Scribd company logo
1 of 16
Download to read offline
DRUPAL CONSOLE
WWW.DRUPALCONSOLE.COM
Martin Hasoň
12. 11. 2015
8. setkání přátel Symfony a Drupal v Brně
CO JE DRUPAL CONSOLE
Kolekce příkazů pro generování kódu a práci s Drupal 8.
Narozdíl od Drush je použita Symfony Console.
Nástroj umožňující ovládat a nastavit Drupal8 bez
webového rozhraní.
Instalace
$ php ­r "readfile('http://drupalconsole.com/installer');" | php
$ mv console.phar /usr/local/bin/drupal
$ drupal init
STAŽENÍ DRUPAL8
$ drupal site:new demo
[+] Getting releases for Drupal
Please select your favorite release
  [8.0.0­rc3    ] 8.0.0­rc3
  [8.0.0­rc2    ] 8.0.0­rc2
  [8.0.0­rc1    ] 8.0.0­rc1
  [8.0.0­beta16 ] 8.0.0­beta16
  [8.0.0­beta15 ] 8.0.0­beta15
  [8.0.0­beta14 ] 8.0.0­beta14
  [8.0.0­beta13 ] 8.0.0­beta13
  [8.0.0­beta12 ] 8.0.0­beta12
  [8.0.0­beta11 ] 8.0.0­beta11
  [8.0.0­beta10 ] 8.0.0­beta10
  [8.0.0­beta9  ] 8.0.0­beta9
  [8.0.0­beta7  ] 8.0.0­beta7
  [8.0.0­beta6  ] 8.0.0­beta6
  [8.0.0­beta4  ] 8.0.0­beta4
  [8.0.0­beta3  ] 8.0.0­beta3
  [8.0.0­beta2  ] 8.0.0­beta2
  [8.0.0­beta1  ] 8.0.0­beta1
  [8.0.0­alpha15] 8.0.0­alpha15
  [8.0.0­alpha14] 8.0.0­alpha14
  [8.0.x­dev    ] 8.0.x­dev
 > 8.0.0­rc3
[+] Downloading Drupal 8.0.0­rc3
[+] Extracting files for Drupal 8.0.0­rc3
[+] Drupal 8.0.0­rc3 was downloaded in directory demo
INSTALACE DRUPAL8
$ cd demo
$ drupal site:install
Select Drupal profile to be installed
  [Minimal ] Minimal
  [Standard] Standard
 > Standard
Select language for your Drupal installation [English]: Czech
commands.migrate.setup.migrations.questions.db­type
  [SQLite                                       ] SQLite
  [MySQL, MariaDB, Percona Server, or equivalent] MySQL, MariaDB, Percona Server, or equivalent
 > MySQL, MariaDB, Percona Server, or equivalent
Database Host [127.0.0.1]: 
Database Name: drupal8_demo   
Database User: root
Database Pass: 
Database Prefix: 
Database Port [3306]: 
Provide your Drupal site name [Drupal 8 Site Install]: Drupal8 Demo
Provide your Drupal site mail [admin@example.com]: 
Provide your Drupal administrator account name [admin]: 
Provide your Drupal administrator account mail [admin@example.com]: 
Provide your Drupal administrator account password: 
[­] Starting Drupal 8 install process
[­] Your Drupal 8 installation was completed sucessfully
PŘÍKAZY PRO DEBUGOVÁNÍ
$ drupal config:debug       # Výpis konfigurace
$ drupal container:debug    # Seznam služeb
$ drupal cron:debug         # Seznam modulů s úlohami pro cron
$ drupal database:log:debug
$ drupal migrate:debug      # Seznam dostupných migrací
$ drupal module:debug       # Seznam dostupných modulů
$ drupal multisite:debug 
$ drupal rest:debug         # Seznam REST zdrojů
$ drupal router:debug       # Seznam rout
$ drupal site:debug         # Seznam lokálních i remote webů
$ drupal update:debug
$ drupal views:debug
PŘIDÁNÍ WEBROFILERU A LIŠTY
$ drupal module:download webprofiler
[+] Getting releases for module webprofiler
Please select your favorite release
  [8.x­2.0­rc3    ] 8.x­2.0­rc3
  [8.x­2.0­rc2    ] 8.x­2.0­rc2
  [8.x­2.0­rc1    ] 8.x­2.0­rc1
  [8.x­2.0­beta16 ] 8.x­2.0­beta16
  [8.x­2.0­beta15 ] 8.x­2.0­beta15
  [8.x­1.1­beta15 ] 8.x­1.1­beta15
  [8.x­1.1­beta13 ] 8.x­1.1­beta13
  ...
 > 8.x­2.0­rc3
[­] Downloading module webprofiler release 8.x­2.0­rc3
[­] Module webprofiler version 8.x­2.0­rc3 was downloaded successfully
$ drupal module:install webprofiler
KONFIGURACE WEBPROFILERU
$ drupal config:edit webprofiler.config
purge_on_cache_clear: true
storage: profiler.database_storage
exclude: "/contextual/*rn/toolbar/*rn/edit/*rn*.jsrn*.css"
ide_link: 'subl://open?url=file://@file&line=@line'
active_toolbar_items:
  assets: assets
  blocks: blocks
  cache: cache
  config: config
  database: database
  events: events
  drupal_extension: drupal_extension
  forms: '0'
  http: '0'
  php_config: php_config
  performance_timing: performance_timing
  request: request
  routing: routing
  services: services
  state: state
  theme: theme
  time: time
  translations: translations
  user: user
  views: views
  mail: '0'
query_sort: source
query_highlight: 5
langcode: cs
KONFIGURACE WEBPROFILERU
DRUPAL8 TIMELINE
SYMFONY TIMELINE
UŽITEČNÉ PŘÍKAZY
Změna módu aplikace
$ drupal site:mode prod
$ drupal site:mode dev
Stránka údržby
$ drupal site:maintenance on
$ drupal site:maintenance off
Export a import nastavení
$ drupal config:export
$ drupal config:import
VLASTNÍ MODUL
$ drupal generate:module
 Welcome to the Drupal module generator 
Enter the new module name: demo
Enter the module machine name [demo]: 
Enter the module Path [/modules/custom]: 
Enter module description [My Awesome Module]: My Demo module
Enter package name [Other]: 
Enter Drupal Core version [8.x]: 
Define module as feature [no]? 
Do you want to add a composer.json file to your module [no]? yes
Would you like to add module dependencies [no]? 
Do you confirm generation [yes]? 
 Generated or updated files 
Site path: /home/hason/Projekty/drupal­test/demo
1 ­ modules/custom/demo/demo.info.yml
2 ­ modules/custom/demo/demo.module
3 ­ modules/custom/demo/composer.json
$ drupal module:install demo
VLASTNÍ CONTROLLER
$ drupal generate:controller
 Welcome to the Drupal Controller generator 
Enter the module name: demo
Enter the Controller class name [DefaultController]: HelloController
Controller title: Hello
Enter the action method name [index]: hello
Enter the route path [demo/hello/{param_1}/{param_2}]: demo/hello/{name} 
Controller title (empty to start with code generation): 
Do you want to generate a unit test class [yes]? no
Do you want to load services from the container [no]? yes
Type the service name or use keyup or keydown.
This is optional, press enter to continue
Enter your service: twig
Enter your service: 
Do you confirm generation [yes]? 
 Generated or updated files 
Site path: /home/hason/Projekty/drupal­test/demo
1 ­ modules/custom/demo/src/Controller/HelloController.php
2 ­ modules/custom/demo/demo.routing.yml
[+] Rebuilding routes, wait a moment please
[+] Done rebuilding route(s).
VLASTNÍ CONTROLLER
<?php
// modules/custom/demo/src/Controller/HelloController.php
namespace DrupaldemoController;
use DrupalComponentUtilityHtml;
use DrupalCoreControllerControllerBase;
use DrupalCoreTemplateTwigEnvironment;
use SymfonyComponentDependencyInjectionContainerInterface;
class HelloController extends ControllerBase {
  protected $twig;
  public function __construct(TwigEnvironment $twig) {
    $this­>twig = $twig;
  }
  public static function create(ContainerInterface $container) {
    return new static(
      $container­>get('twig')
    );
  }
  public function hello($name) {
    return [
        '#type' => 'markup',
        '#markup' => sprintf('Hello %s!', Html::escape($name)),
    ];
  }
}
VLASTNÍ CONTROLLER A ŠABLONA
// modules/custom/demo/src/Controller/HelloController.php
//...
use SymfonyComponentHttpFoundationRequest;
use SymfonyComponentHttpFoundationResponse;
class HelloController extends ControllerBase {
  // ...
  public function hello(Request $request, $name) {
    return new Response(
        $this­>twig­>render('@demo/hello.html.twig', ['name' => $name])
    );
  }
  // ...
}
{# modules/custom/demo/templates/hello.html.twig #}
Hello {{ name }}!
A TO UŽ JSME V SYMFONY!
https://github.com/hason
https://twitter.com/@hasonm
https://www.webuni.cz

More Related Content

Similar to Drupal console

Modernize Your Drupal Development
Modernize Your Drupal DevelopmentModernize Your Drupal Development
Modernize Your Drupal Development
Chris Tankersley
 
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyondAutomating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Nuvole
 

Similar to Drupal console (20)

Managing your Drupal project with Composer
Managing your Drupal project with ComposerManaging your Drupal project with Composer
Managing your Drupal project with Composer
 
Message Queues and Drupal
Message Queues and DrupalMessage Queues and Drupal
Message Queues and Drupal
 
Rhel8 Beta - Halifax RHUG
Rhel8 Beta - Halifax RHUGRhel8 Beta - Halifax RHUG
Rhel8 Beta - Halifax RHUG
 
Building Your Own Drupal Distribution
Building Your Own Drupal DistributionBuilding Your Own Drupal Distribution
Building Your Own Drupal Distribution
 
RHEL8-BETA-RHUG.pdf
RHEL8-BETA-RHUG.pdfRHEL8-BETA-RHUG.pdf
RHEL8-BETA-RHUG.pdf
 
Face your fears: Drush and Aegir
Face your fears: Drush and AegirFace your fears: Drush and Aegir
Face your fears: Drush and Aegir
 
Drupal 8 cli
Drupal 8 cliDrupal 8 cli
Drupal 8 cli
 
Drupal 8 update: May 2014. Migrate in core.
Drupal 8 update: May 2014. Migrate in core.Drupal 8 update: May 2014. Migrate in core.
Drupal 8 update: May 2014. Migrate in core.
 
drupal_training
drupal_trainingdrupal_training
drupal_training
 
Drupal VM for Drupal 8 Dev - Drupal Camp STL 2017
Drupal VM for Drupal 8 Dev - Drupal Camp STL 2017Drupal VM for Drupal 8 Dev - Drupal Camp STL 2017
Drupal VM for Drupal 8 Dev - Drupal Camp STL 2017
 
Modernize Your Drupal Development
Modernize Your Drupal DevelopmentModernize Your Drupal Development
Modernize Your Drupal Development
 
[Srijan Wednesday Webinars] Faster and Smarter Development with Drupal Console
[Srijan Wednesday Webinars] Faster and Smarter Development with Drupal Console[Srijan Wednesday Webinars] Faster and Smarter Development with Drupal Console
[Srijan Wednesday Webinars] Faster and Smarter Development with Drupal Console
 
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyondAutomating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
 
Introduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, TerminologiesIntroduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, Terminologies
 
20120314 voipdrupal-hands-on-webinar
20120314 voipdrupal-hands-on-webinar20120314 voipdrupal-hands-on-webinar
20120314 voipdrupal-hands-on-webinar
 
Satellite 6 - Pupet Introduction
Satellite 6 - Pupet IntroductionSatellite 6 - Pupet Introduction
Satellite 6 - Pupet Introduction
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and Drush
 
A Drush Primer - DrupalCamp Chattanooga 2013
A Drush Primer - DrupalCamp Chattanooga 2013A Drush Primer - DrupalCamp Chattanooga 2013
A Drush Primer - DrupalCamp Chattanooga 2013
 
Docker4Drupal 2.1 for Development
Docker4Drupal 2.1 for DevelopmentDocker4Drupal 2.1 for Development
Docker4Drupal 2.1 for Development
 
Drush A beginners guide to a advanced tool.
Drush A beginners guide to a advanced tool.Drush A beginners guide to a advanced tool.
Drush A beginners guide to a advanced tool.
 

Recently uploaded

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 

Drupal console