Skip to main content

Posts

What is docker & vagrant and how to use it

Why Need Docker :  Lets suppose we are working in a large application which needs ,Drupal 8 ,PHP7.4, Mysql 8, Redis server, Mongodb,solar server, nodejs server etc. And at the same time I also give maintenace for another project on drupal 7, But it needs some old version of php, mysql,redis etc because it is old project developed 4 year before. So it's too complicated to run both the project in same machine just because of dependencies, Proublem 2 : Lets suppose in local we work on apache & sqlite & on production nginx & mysql, So may be some issue should be raised in production, To handing this type of situation Docker & vergant is much helpfull. How is Docker Different from Vagrant?: Docker :  Docker  is often described as "lightweight," because it simply provides containers within the host machine's Linux operating system. Docker containers hold an application's components, including binaries, libraries, and configurations, as we...

Unit Test With Drupal 8

Types of tests: Writing tests All PHP-based tests for Drupal core are written using the industry-standard PHPUnit framework, with Drupal extensions. There are several categories of tests; each has its own purpose, base class, namespace, and directory: Unit tests: Purpose : Test functionality of a class if the Drupal environment (database, settings, etc.) and web browser are not needed for the test, or if the Drupal environment can be replaced by a "mock" object. Base class :   \Drupal\Tests\UnitTestCase Namespace : \Drupal\Tests\yourmodule\Unit (or a subdirectory) Directory location : yourmodule/tests/src/Unit (or a subdirectory) Kernel tests: Purpose : Test functionality of a class if the full Drupal environment and web browser are not needed for the test, but the functionality has significant Drupal dependencies that cannot easily be mocked. Kernel tests can access services, the database, and a minimal mocked file system, and they use an in-memory pseudo-installation. Howe...

Best Way to use composer with drupal in multi environment(dev,stage,prod)

NOTE :  it’s extremely important that your development environment is using the same version of PHP that the target production environment will use. Otherwise Composer may download packages that won’t work in production.   (With larger development teams, using something like  Vagrant  or Docker for local development can help ensure compatibility between local development instances and the production stack How do I download modules and themes: 1 - composer require drupal/devel  it would download the module to web/modules/contrib. If you want to change the download destination, you can alter the paths in your composer.json.  Development Dependencies: composer require --dev drupal/devel  For example, since the Devel module shouldn’t be used in a production environment, you may only want it to get downloaded on development environments. With Composer, you can achieve this by passing the --dev flag to the composer require command. This wi...

Chatbot API for Drupal 8

Historically, we have many ways of serving content digitally: through a website, mobile apps, social media, RSS feeds, RESTful APIs ,email.  Now we have a new player in the game: chatbots and personal assistants.  Chatbot API for Drupal 8

New technology , Features

New Drupal 8 Module Travis CI Integration : Unit Test With Codes Cloud AWS Chatbot API All Example module d8 : It covers everything Field API :  https://www.drupal.org/docs/8/creating-custom-modules/creating-custom-field-types-widgets-and-formatters https://www.drupal.org/docs/8/creating-custom-modules/creating-custom-field-types-widgets-and-formatters/create-a-custom custom Field widget custom field formater Automated cron in d8 Search API's in d8 Render API Design Pattern : https://www.youtube.com/watch?v=wlfslHpiS4I&list=PLY-mQxqgVZ1wrwNa86_smHF8TTS34CNW4&index=21 Best Way ti use Composer with git:  Cache in Drupal 8 With tutorial :  Create patches & apply patches git : Postman API demostration

Basic Vim commands in Linux

Basic Vim commands :help [keyword]  - Performs a search of help documentation for whatever keyword you enter :e [file]  - Opens a file, where [file] is the name of the file you want opened :w  - Saves the file you are working on :w [filename]  - Allows you to save your file with the name you’ve defined :wq  - Save your file and close Vim :q!  - Quit without first saving the file you were working on

Git Tutorial

Steps To Configure new folder git setup :   git init git config --global user.name "USERNAME" git config --global user.email "GITMAILID" git remote add origin https://github.com/Dharmend/multisite.git git config core.filemode false Git Checkout performs the three types of operations :   1 – Checkout files , ( git chekout aa.txt ) 2 – Checkout branch , ( git checkout “branch name” ) 3 – Checkout commits , ( git checkout k9s7hjkh76 ) git diff :     Command : git diff To show the difference between last commit file and current change file,if you add file in staging area then it will not show the diff, to see the diff use git diff --cached git checkout vs git revert vs git reset :     git checkout - download the updated code of the branch and file while HEAD is not changed While git reset, moves both the HEAD and branch refs to the specified commit git revert- The git revert command is a forward-moving undo operat...