Friday, March 20, 2020

Check deprecation and Make your project Drupal 9 compatible


Hello Drupalers,

As we know Drupal 9 will be release at 3rd of june 2020.

Drupal 9 = Drupal 8 - remove deprecation + increase dependency package


you are here because you also want to know ->

  • How we can make our project Drupal 9 compatible ? 
  • How we can check deprecated code ?


Drupal-check :- We can check all deprecated method using the "drupal-check".


Drupal check will provide you a result based on your project which deprecated method you used in your code and in the place of that code what should we should.


Install Drupal -check : - Download package using below command

 curl -O -L https://github.com/mglaman/drupal-check/releases/latest/download/drupal-check.phar  
 mv drupal-check.phar /usr/local/bin/drupal-check  
 chmod +x /usr/local/bin/drupal-check  


Composer :-
You can install this in your project using Composer as a development dependency like so:

 composer require mglaman/drupal-check --dev  


You can also install this globally using Composer like so:


 composer global require mglaman/drupal-check  


 Check Deprecation :- Now your system is ready to check any Drupal check with deprecation then you can make the project compatible with Drupal 9

If you installed drupal-check locally, open your terminal and run below command.

 lenovo@lenovo-ThinkPad-L450:/var/www/html/drupal_directory $ vendor/bin/drupal-checck web/modules/contrib/module_name  



If there is any error you will be able to see result like :-


  21   Call to deprecated function db_select():                  
      in drupal:8.0.0 and is removed from drupal:9.0.0. Instead, get       
      a database connection injected into your service from the container and   
      call select() on it. For example,                      
  ------ -------------------------------------------------------------------------  
  [ERROR] Found 1 errors  


Now you can remove deprecated code and make its Drupal 9 compatible.



How Drupal will know your project Drupal 9 compatible ?

Here is a way to let know Drupal.org that our module is Compatible with Drupal 8 and Drupal 9

 core_version_requirement: ^8 || ^9  


Add this line in your project info file. If want to know more about core_version_requirement see core_version_requirement



I hope guys you like this, if you have any suggestion and correcction feel free to comment here. Thanks 😊

Thursday, March 19, 2020

How Drupal Core release version decides ?

Hello Drupalers,

There is one interesting thing about Drupal version.

Have you ever been thought how core contributor decided the Drupal release number ? 🤔


Today i am going to tell you how the core release version decide.

"Since Drupal 8.8.0 Core release follow the semantic versioning (semver) numbering system."

  • Semantic versioning numbering uses three numbers instead of two  i.e (8.2.6)

In 8.2.6 first number is the major release number, second is minor number and third is patch number .

First Number (Major version) :- You are actually breaking API , there's no backwards compatibility with old API.

Second Number (Minor version) :- Minor version does not break compatibility with old version (Drupal 8.2 won't break compatibility of 8.1), This number is used for big changes or new feature.

Third Number (Patch Number) :- last number only shows bug fixes.


For more information please visit :-  Drupal Core release cycle

"Most Welcome any suggestion and correction in blog".

Thanks 🙂

Headless drupal 8 with vue js

Hello Drupalers,

Today i am going to show you how can create headless website with  Drupal 8 and vue.



We will step by step to create headless website.

Step 1 : -  Install a fresh Drupal 8.  In my case i  installed drupal with composer .

 composer create-project drupal-composer/drupal-project:8.x-dev decoupled_drupal --stability dev --no-interaction  

Step 2 : - In this case we will use rest api to get  drupal content data in our vue app using "REST Module."


Step 3 :-  Create custom content type as  i have created content type "Album" and added some fields











Step 4 :- create view for rest export data.

 make sure your api path (i.e api/edm-album)


Note : Now Drupal is ready for headless use now we will create vue frontent to get this api data and will dispaly on frontent.



Step 5  :- Inside of your Drupal folder install Vue-cli wo we can use


 lenovo@lenovo-ThinkPad-L450:/var/www/html/decoupled_drupal/drupalvue $ sudo npm install -g vue-cli  

Step 6 :-  Setup Vue instance for headless use

 vue init webpack <name_of_project folder>  
 # install dependencies and go!  
 cd <name_of_project folder>  
 //install node dependencies from package json  
 npm install  
 // run this command to start your project  
 npm run dev  





Last command is used for serve react application and after that you will be able to see some url like

http://localhost:8080/


make sure you are running above commands from your drupalvue directory.