Raised: $0
0% of monthly goal Help us cross the finish line!
Goal: $12,000
Raised: $0 Goal: $12,000
0% of monthly goal Help us cross the finish line!
Sponsor DDEV

add-on registry tests last commit release

ddev-tinker

What is ddev-tinker?

ddev-tinker is an addon for DDEV that providers a single command to access a runtime developer console.

This addon enables a new command, ddev tinker, that checks which project you are currently in, and runs the correct REPL command for the project.

If you bounce between projects types, this command is really useful.

What is this developer console?

Both Laravel and Drupal have an interactive debugger & REPL environment for tinkering in PHP. You can test various php statements, resolve services or even query the database!

Both environment’s are customized versions of the excellent PsySh.

Typically, this console is accessed via:

Supported frameworks

This addon current supports the following frameworks:

PRs are welcome to add more frameworks.

Getting started

  1. Install the addon

    ddev add-on get tyler36/ddev-tinker
    

The addon installs globally and will be available to supported framework after running ddev start.

Usage

To start your framework’s REPL environment, simply type the follow:

   ddev tinker

Arguments

While this might be helpful for a quick one-off command, it’s recommend to run ddev tinker for tinkering to avoid any Docker connection delays between multiple commands.

Wrapping may also work with ", depending on the command used. For more consistent results between frameworks and host OS, it is recommended to use '. See ddev/ddev#2547

Doc command

Out of the box, Psysh contains a doc command that reads “… the documentation for an object, class, constant, method or property”.

This add-on downloads the Psysh PHP English manual to the required location for Psysh to find it in the container. For other languages, manually download the file from here, and place it in your project’s .ddev/homeadditions/.local/share/psysh folder.

To use the manual, start a session and type doc [FUNCTION_NAME]:

$ ddev tinker
Psy Shell v0.11.13 (PHP 8.1.21 — cli) by Justin Hileman
> doc array_unique
function array_unique(array $array, int $flags = 2): array

Description:
  Removes duplicate values from an array
...

Contributed and maintained by @tyler36 based on the original ddev-contrib recipe by @tyler36