Drupal 7 Php Support

  1. Drupal 7 Support Php 7.3
  2. Drupal 7 Php Support Download
  3. Drupal 7 Php Support
  4. Drupal 7 Php 7.4 Support

June 29, 2020: Drupal 7 end of life has been extended to November 2022 due to the covid-19 pandemic. For more details on this, please see our updates in our post, Extending Drupal 7's End of Life: What's a nonprofit to do now? An Update.

This week, Dries announced at DrupalEurope, and on his blog, that November 2021 will be the End of Life date for both Drupal 7 and Drupal 8. 'End of Life' (EOL) means that a version is no longer supported by core maintainers with fixes, security releases, or enhancements.

Drupal 9 is now scheduled to be released in 2020, giving people a year to upgrade from version 8 to version 9, before Drupal 8's EOL.

Why is Being on a Supported Version Important?

The Drupal community will support Drupal 7 until November 2022. Buytaert has stated that after the community support ends, there will be extended commercial support for a minimum of three additional years, ensuring Drupal 7 will be supported for at least five more years, or until 2025. The Drupal Wincache module has also been brought up to date, updated to Drupal 8 and made PHP 7 ready. Database PDO driver - MSSQL: The MS team is working intensively into making PHP 7 on SQL Server a reality, and providing Linux support. You can follow their work here. With the latest release (4. Drupal 8 supports PHP 7.0 to 7.4 right now and the issue I mentioned earlier also tries to add support for PHP 8 to Drupal 8.9 as well (it looks like it might just happen as well). This makes the challenge of supporting PHP 8 in Drupal even bigger as we have to support several breaking changes simultaneously. Drupal 7 core: The primary PHP 7.3 support issue for Drupal 7 core was resolved in December of 2019 and released in 7.68. Two related issues highlight some of the known compatibility issues for contributed projects. This is not exhaustive. PHP 7.3 deprecations: The PHP 7.3 migration guide has a set of deprecations defined here.

Being on a version of Drupal that's 'no longer supported' means that it will not be updated when new security vulnerabilities are discovered. Your site's data and infrastructure would be at a much higher risk of hacking than usual.

How Does this Affect Resource-constrained Nonprofits Using Drupal?

At first glance, this seems pretty concerning. At the moment, 4 out of 5 Drupal sites are still on Drupal 7, and about 20% are on Drupal 8. If your org is still on Drupal 7, then why should you bother upgrading to 8? Should you wait for 9? OMG?!

Don’t Panic! There’s a Reasonable Plan

This is a new release model, and it’s really different.

  • The D8-D9 upgrade is planned to be much less dramatic than any major version upgrade in the past, because the code between the versions will be very similar.

  • Major contributed modules will be usable in both Drupal 8 and 9, simultaneously. This is really different from how it’s ever worked, and underscores how similar the two versions are intended to be.

Here’s Our Recommendation in the Meantime (which hasn’t really changed)

  • Get onto Drupal 8 when you can;
  • Keep it up to date! Because up-to-date sites are more secure, and will be the most seamless to upgrade to D9.
  • and stay on the Drupal superhighway. By this, we mean that when you choose contributed modules to extend Drupal’s core functionality, choose well-vetted, heavily-used, “best practices” modules as much as you can.
Drupal 7 Php Support

Why is this Even Happening?

This is all about dependencies. Drupal 8's API is built on top of several other codebases. If Drupal is a LEGO set, its bricks include PHP, Symfony, Twig, and a few other frameworks. It’s extremely important to the Drupal community that Drupal core remains secure. That means that when these building blocks get deprecated, and are no longer supported by their communities with security releases, changes, and enhancements, then those bricks need to be upgraded in Drupal core so that Drupal core stays secure and functional.

Over the next year, Drupal Core maintainers will be going through the codebase to see what parts of Drupal’s API depend on bits of PHP, Symfony, Twig, etc. that will be changed or retired in the next releases of those systems. Just like we don’t want to have Drupal sites that the Drupal community no longer supports, Drupal doesn’t want to depend on a building block that is no longer being fixed and maintained.

When Drupal 9 is released, it will be the same as the latest Drupal 8 release, but it will no longer include any of those deprecated building blocks. Ostensibly, this means that if you’ve got a healthy, up-to-date Drupal 8 site, an upgrade to Drupal 9 will be fairly minor. It will be nothing like the radical changes that happened under the hood between Drupal 7 and 8.

For more in-depth information on all of this, please see this overview of the Drupal 7 and 8 EOL announcement, by the always-helpful Damien McKenna of Mediacurrent.

Is any of this set in stone? As Damien said in his disclaimer on that call, some of it is, but a lot of it is still in flux. That’s how web technology rolls. We can plan as best we can with the information we have, but we also have to do some waiting-and-seeing. But for the moment, there’s a lot of hope that this new release model will be manageable.

Once More, with Feeling

Is a Drupal site right for you, but your org is not swimming in gold bullion web development dollars? On Drupal 7 still? Continue working toward moving to D8, as soon as you can. When you choose contributed modules, stick to the Drupal Superhighway as much as you can. Once you’re on D8, keep your site up-to-date! As always, we promise to keep watching this space, and to share back what we learn. Stay tuned to nonprofit Drupal channels for news.

Thanks to Damien McKenna, Paige Eaton, Erin Fogel, and Jess Snyder.

June 29, 2020: Drupal 7 end of life has been extended to November 2022 due to the covid-19 pandemic. For more details on this, please see our updates in our post, Extending Drupal 7's End of Life: What's a nonprofit to do now? An Update.

You can use PhpStorm as an IDE for Drupal development including modules, themes, and core. The supported versions are 6, 7, and 8.

PhpStorm provides integration between the Symfony2 and Drupal 8 while developing Drupal modules and core.

Downloading and installing Drupal

Download Drupal from the Drupal Official website and install it as described in the Drupal installation instructions.

Setting up a Drupal project in PhpStorm

Option 1: Create a PhpStorm project with a Drupal module

You can create a PhpStorm project by a Drupal Module template, this project will be set up and configured in accordance with the Drupal requirements.

PhpStorm generates and configured a project stub in accordance with the selected Drupal version. For Drupal 8, a module_name.info.yml file is generated.

  1. Open the New Project dialog

    Choose File New Project or click Create New Project on the PhpStorm Welcome screen.

  2. Choose the project type and location

    In the left-hand pane, select Drupal Module.

    In the Location field on the right-hand pane, specify the folder where the project will be created.

  3. Choose Drupal installation to use

    Specify the root folder of the Drupal installation and choose the version of Drupal to use, the supported versions are 6, 7, and 8.

    Later you can change the Drupal installation and re-configure the include paths on the Frameworks page as described in Changing the Drupal settings

  4. Configure Include paths

    Select the Set up PHP Include paths checkbox to have Drupal include paths automatically configured for the project. After you leave the dialog, the following paths will be added to the Include Paths list on the PHP page: <drupal installation root>/includes, <drupal installation root>/modules, and <drupal installation root>/sites/all/modules

When you open an existing Drupal module, PhpStorm recognizes the Drupal-specific structure and suggests activating the Drupal support.

  1. Open your project

    Click Open on the Welcome screen or choose File Open from the main menu, then choose the folder where your Drupal module is stored.

    PhpStorm detects a Drupal-specific structure and shows a notification:

  2. Enable Drupal support

    Click Enable in the notification. In the Drupal Module dialog that opens, select the Enable Drupal integration checkbox and proceed as when creating a project with a Drupal module: specify the root folder of the Drupal installation, choose the version to use, and configure include paths.

Whether you enable the Drupal support in an existing PhpStorm project or create a new project with a Drupal module, PhpStorm checks if the development environment is configured properly for Drupal development.

Any detected inconsistency is reported in the Event Log tool window and as a popup For each discrepancy PhpStorm suggests a fix. To apply a suggestion, click the link next to the reported event.

Associating Drupal-specific files with the PHP file type

PhpStorm recognizes and treats files as php files and provides code highlighting based on file type associations.

Option 1: Use the Event log

  • In the Event Log tool window, click Fix next to the Drupal support: <*.file extension> files are not associated with PHP file type message.

Option 2: Use the File Types page

  • In the Settings/Preferences dialog Ctrl+Alt+S, navigate to Editor File Types.

    On the File Types page that opens, define file masks in the File Name Patterns area. See Set file type associations for details.

Changing the Drupal settings

Option 1: Enable or disable Drupal integration

  • In the Settings/Preferences dialog Ctrl+Alt+S, navigate to PHP Frameworks. On the Frameworks page that opens, toggle the Enable Drupal integration checkbox to activate or deactivate Drupal in the current PhpStorm project.
    To use another Drupal installation, type the path to the relevant installation folder. Change the version if necessary.

Option 2: Update the include paths

  • In the Settings/Preferences dialog Ctrl+Alt+S, navigate to PHP.

    On the PHP page that opens, make the required changes in the Include Paths area.

If the Drupal integration is disabled, the paths are automatically excluded.

Using Drupal hooks in PhpStorm

PhpStorm provides full native support of Drupal hooks in .module files.

  • Use code completion for hook declarations

    PhpStorm indexes any hook invocation whereupon hook names become available in code completion for creating hook implementations. To complete a declaration, start typing the hook name and press Ctrl+Space.

  • Navigate to hook invocations

    • To navigate to a hook invocation from the editor, click the icon in the gutter.

    • In case of multiple invocations, PhpStorm displays a list of available hook invocations, and you can choose the one to jump to.

      You will be navigated to the line where the relevant hook is invoked with module_invoke_all(), module_invoke(), or drupal_alter().

  • View hook documentation

    Position the caret at the name of the hook and choose View Quick Documentation Lookup or press Ctrl+Q.

Documentation is taken from .api.php files provided by core and many other modules for reference purposes.

Setting up Drupal code style in a PhpStorm project

PhpStorm automatically offers to apply the pre-configured Drupal Coding Standards (code style) if a project is recognized as a Drupal Module, or if the Drupal integration is enabled in an existing project, or when you create a new project with a Drupal Module. However, you can at any time change or customize this setting on the Code Style: PHP page of the Settings dialog.

Use the pre-configured Drupal code style in a project

  • In the Event Log tool window, click Set next to the Drupal-style formatting can be set for this project message.

You can also set the predefined code style on the Code Style: PHP page. In the Settings/Preferences dialog Ctrl+Alt+S, navigate to Editor Code Style PHP. Then, click Set from and choose Predefined Drupal.

If applicable, customize the code style using the controls on the page.

Checking code against the Drupal coding standards

With PhpStorm, you can use the PHP_CodeSniffer tool, which detects coding standard issues, in combination with Coder, which provides a set of Drupal-specific standards to PHP_CodeSniffer. This will ensure that your code is clean, consistent, and free of some common errors.

To get started, install PHP_CodeSniffer using any technique described in Install and configure PHP_CodeSniffer. Probably the easiest way is to install it with Composer.

Install PHP_CodeSniffer

  1. Inside composer.json, add the squizlabs/php_codesniffer dependency record to the require or require-dev section. Press Ctrl+Space to get code completion for the package name and version.

  2. Do one of the following:

    • Click the Install shortcut link on top of the editor panel.

    • If the Non-installed Composer packages inspection is enabled, PhpStorm will highlight the declared dependencies that are not currently installed. Press Alt+Enter and select whether you want to install a specific dependency or all dependencies at once.

Next, install Coder, which will provide Drupal-specific standards to PHP_CodeSniffer.

Install Coder

  1. Inside composer.json, add the drupal/coder dependency record to the require or require-dev section. Press Ctrl+Space to get code completion for the package name and version.

  2. Do one of the following:

    • Click the Install shortcut link on top of the editor panel.

    • If the Non-installed Composer packages inspection is enabled, PhpStorm will highlight the declared dependencies that are not currently installed. Press Alt+Enter and select whether you want to install a specific dependency or all dependencies at once.

The Coder package will be installed, and the corresponding Drupal standard will be selected for the PHP_CodeSniffer validation inspection automatically. If necessary, you can further customize the inspection on the Editor Inspections page of the Settings/Preferences dialog Ctrl+Alt+S. See Configure PHP_CodeSniffer as a PhpStorm inspection for details.

Viewing the Drupal API documentation from PhpStorm

In the PhpStorm editor, select the symbol you are interested in and choose Search in Drupal API from the context menu. The Drupal API Documentation opens.

Using the Drush command line tool from PhpStorm

PhpStorm integrates with the Drush command line shell and scripting interface version 5.8 and later. Before you begin, download and install Drush as described at https://github.com/drush-ops/drush.

Configure Drush automatically

  • On project opening, PhpStorm will detect and configure Drush and display the notification in the Composer Log.

    If you want to customize the tool, click to quickly jump to the Command Line Tool Support settings page.

    On Windows, automatic Drush detection requires a configured local PHP interpreter.

Configure Drush manually

  1. In the Settings/Preferences dialog Ctrl+Alt+S, go to Tools Command Line Tool Support.

  2. Click on the toolbar.

  3. In the Command Line Tools dialog, choose Drush from the list, and specify its visibility level (Project or Global ).

  4. When you click OK, the Drush dialog opens.

    Specify the path to the Drush executable. The default location is commonly C:/ProgramData/Drush/drush.bat on Windows and /usr/bin/drush on macOS or Linux. If you followed the standard installation procedure, click OK to accept the predefined path.

    In case of custom installation, type the path to the Drush executable file and click OK.

  5. Click OK to apply changes and return to the Command Line Tool Support page. Optionally, click to edit the tool properties, or to customize the commands set. See Customize a tool for details.

Run Drush commands

  • From the main menu, choose Tools Run Command or press Ctrl twice.

    In the Run Anything window that opens, type the call of the command in the <drush> <command> format.

    The command execution result is displayed in the Run tool window.

Drupal 7 Support Php 7.3

Terminate a command

  • Click on the Run tool window toolbar.

Debug Drush commands

Drupal 7 Php Support Download

Drupal commands are defined in controller classes that extend DrushCommands. To debug a command, it is crucial that you initiate a debugging session for the command itself, and not the controller class file it is defined in. Otherwise, the Drupal bootstrapping process will be skipped, and the execution will fail.

  1. In the controller class corresponding to the selected command, click the editor gutter at a code line where you want to set a breakpoint.

  2. Create a run/debug configuration that will run the drush tool with the selected command. In the main menu, select Run Edit Configurations, then click and choose PHP Script from the list.

  3. In the PHP Script dialog, provide the run/debug configuration parameters.

    • In the File field, provide the path to the drush executable file.

    • In the Arguments field, type the actual command and its arguments, such as status.

  4. On the PhpStorm toolbar, select the created run/debug configuration and click . The command execution will stop at the specified breakpoint.

Using Drupal 8 with Symfony2

PhpStorm provides close integration between Drupal, version 8, and Symfony2. Through this integration, Symfony2 components are connected with Drupal infrastructure. To take advantage of this integration:

  1. Install the Drupal Symfony2 Bridge plugin

    In the Settings/Preferences dialog Ctrl+Alt+S, navigate to the Plugins page. Click Browse Repositories, select the plugins and click Install. For details, see Manage plugins.

  2. Enable annotations

    To get advanced annotations support, install the PHP Annotations plugin as described in Manage plugins.

The Drupal Symfony2 Bridge plugin depends on the Symfony2 plugin, which will be installed automatically.

What coding assistance for Drupal 8 - Symfony2 integration is available?

Drupal 7 Php Support

Php
  • Completion for major Drupal-specific parameters in <module_name>.info.yml files that contain information about Drupal modules.

  • Strings suitable for use inside Drupal-specific t() function are indexed across your project and offered for completion.

  • Completion for relevant yml key values in url() and other Drupal API functions, which makes search for the right value easier.

  • Navigation to the yml file by pressing Ctrl+B or choosing Navigate Go To Declaration.

  • Full support for service containers described in yml files, including completion and navigation with Ctrl+B.

  • Support of the Twig template engine, which is now the default template engine for Drupal 8, including completion, navigation, and recognition of Drupal functions. See also Twig in Drupal 8.

Drupal 7 Php 7.4 Support

Last modified: 08 March 2021