Coder Social home page Coder Social logo

ezsh's Introduction

eZ Debug Shell

eZ Debug Shell is an interactive CLI debugger for eZ Platform. It is built on top of PsySH and thus acts as a Read-eval-print-loop (aka repl).

It allows you to debug live code in the context of an eZ Publish application, avoiding to create CLI commands.

Install

Global install (recommended)

composer global require lolautruche/ezsh:^2.0

v1.0 is compatible with eZ Publish 5.3+ while v2.0 is only compatible with eZ Platform.

This will install ezsh executable into the ~/.composer/vendor/bin folder.

For ezsh to work properly without hassle, ensure you have ~.composer/vendor/bin in your $PATH:

export PATH=~/.composer/vendor/bin

Project install

You can install ezsh binary in your eZ project with Composer:

composer require lolautruche/ezsh:^2.0

Usage

Usage:
  ezsh [--siteaccess=<siteaccess_name>] [--env=<env>] [--debug] [--version] [--help] [user_login]

Options:
  --siteaccess    -s SiteAccess to use (e.g. ezdemo_site). If not provided, fallbacks to configured default SiteAccess.
  --env           -e Environment to use (defaults to "dev").
  --debug         -d Use debugging if provided. Debug is always on with "dev" environment.
  --help          -h Display this help message.
  --version       -v Display the PsySH version.
  --config        -c Use an alternate PsySH config file location.
  
  user_login      User login (i.e. username) to use to authenticate against the repository. If not provided, anonymous user will be used.

Important: To be able to use ezsh, you first need to be in your eZ project root:

cd /my/ezpublish/root
ezsh --siteaccess=my_siteaccess

This will display something like:

Debugging eZ Publish using 'my_siteaccess' SiteAccess, in 'dev' environment.
Psy Shell v0.8.9 (PHP 7.0.19 — cli) by Justin Hileman
>>>

Starting from here, you'll be able to evaluate any kind of code in the context of your project.

Available variables

Some variables are already set for you, like the service container, the ConfigResolver and the Repository:

Variable Description
$container Instance of Symfony ServiceContainer. Get your services with it
$kernel Instance of your EzPublishKernel
$repository Instance of the eZ Content repository (to use API)
$contentService The ContentService
$contentTypeService The ContentTypeService
$locationService The LocationService
$searchService The SearchService
$userService The UserService
$configResolver The ConfigResolver (to get SiteAccess aware settings)

Example

From the debug shell, you can define any kind of functions, loops, conditions...
For more information see PsySH documentation.

Debugging eZ Platform using 'default' SiteAccess, in 'dev' environment.

Psy Shell v0.1.12 (PHP 5.5.15 — cli) by Justin Hileman
>>> $repository
=> <eZPublishCoreSignalSlotRepository_000000001c2171540000000109a6622a #000000005890a1640000000113a69e24> {}
>>> $contentInfo = $contentService->loadContentInfo(2926);
=> <eZ\Publish\API\Repository\Values\Content\ContentInfo #2926, Wheelchair Barleywine {
       id: 2926,
       contentTypeId: 40,
       name: "Wheelchair Barleywine",
       sectionId: 1,
       currentVersionNo: 1,
       published: true,
       ownerId: 14,
       modificationDate: <DateTime #00000000588e6c020000000142ceef3a> {
           date: "2014-08-28 10:32:44.000000",
           timezone_type: 3,
           timezone: "Europe/Paris"
       },
       publishedDate: <DateTime #00000000588e6c0c0000000142ceef3a> {
           date: "2014-08-28 10:32:44.000000",
           timezone_type: 3,
           timezone: "Europe/Paris"
       },
       alwaysAvailable: 0,
       remoteId: "beer-d7nEsv",
       mainLanguageCode: "eng-GB",
       mainLocationId: "2928"
   }

>>> $configResolver->getParameter('languages');
=> [
       "eng-GB"
   ]

ezsh's People

Contributors

lolautruche avatar bobthecow avatar wizhippo avatar nicolas-grekas avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.