Is a good practice to inject a service whenever is possible.
Reading the code on the Drupal
Class you can find the httpClient
method:
/**
This document contains a common database updates in Drupal 7 projects.
Let's suppose we want to change field_article_summary
from text to textarea, but we do not care
about loosing its current data.
Start by removing the field through the Admin Interface in your local environment. Then, add the field with the new configuration and recreate the feature where it was exported. Finally, add the following database update:
# This can be added to your cron job to run right after Drupal's cron or combine them into a single command so | |
# that it automatically executes when the cron run completes. | |
wget -q http://www.example.com/sitemap.xml -O - | egrep -o "http://www\.example\.com[^<]+" | wget -q -i - -O /dev/null --wait 1 |
alias composer='php composer.phar' | |
alias composerinit='curl -s http://getcomposer.org/installer | php; composer init; echo composer.phar >> .gitignore' | |
alias composerdump='composer dumpautoload --optimize' |