Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Modification fork infos to be correlated with this branch
  • Loading branch information
garstud authored Oct 4, 2020
1 parent 47630d7 commit 466c29f
Showing 1 changed file with 69 additions and 29 deletions.
98 changes: 69 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,30 @@ J!Dump README

Advanced print_r and var_dump replacer with object tree display.

Follow [@mathiasverraes](http://twitter.com/mathiasverraes) for updates.

[Vote for this extension at the JED](http://extensions.joomla.org/extensions/miscellaneous/development/1509)

Features
--------

This utility makes life easy for developers and template designers. You use it to
see what's inside a variable, an array or an object. Instead of using print_r() or
var_dump(), you can now use dump(). This will open a popup window with a nice expandable
This utility makes life easy for developers and template designers. You use it to
see what's inside a variable, an array or an object. Instead of using print_r() or
var_dump(), you can now use dump(). This will open a popup window with a nice expandable
tree, showing the contents of the variable. It will even show a list of available
methods for each object. You have to see it to believe it! You can use dump() in your
methods for each object. You have to see it to believe it! You can use dump() in your
extensions, in the core, in libraries and even in templates.

**Warning!** This component is only meant to be used on development test sites, NOT
in live or production environments. If you must use it on a live site, don't do
**Warning!** This component is only meant to be used on development test sites, NOT
in live or production environments. If you must use it on a live site, don't do
stupid things like dump($password) !

Download
--------

- [Download ready-made packages](https://github.com/mathiasverraes/jdump/downloads)
- ...or make your own with [Phing](http://www.phing.info/trac/wiki/Users/Download)

```shell
git clone git://github.com/mathiasverraes/jdump.git
cd jdump
phing
```

The zip will be in the build/packages folder.
- [Download last package](https://github.com/garstud/jdump/releases/latest)
(successfully tested under Joomla 3.9.21)

Installation
------------
Since 1.2.2 just install the package file (pkg_jdump_v*.zip). It will automatically install and publish JDump component and plugin.

Install both the component and the plugin. Make sure the plugin is published. But
you probably figured that out already.

If you don't want the dump popup window to appear automatically, you can disable
If you don't want the dump popup window to appear automatically, you can disable
it in the configuration. To display the dump window manually:

- **Administrator**: Go to Components -> J!Dump and click Popup.
Expand All @@ -56,9 +41,11 @@ Anywhere in your code, type:
dump($variable, 'Variable Name');
```

Simple huh? 'Variable Name' is optional and can be anything you like. If you use
Simple huh? 'Variable Name' is optional and can be anything you like. If you use
a lot of dumps, you'll want to use some descriptive names.



Shortcuts
---------

Expand Down Expand Up @@ -86,13 +73,66 @@ dumpTrace();
Notes
-----

You can't use dump() in system plugins that are run before the J!Dump plugin is run,
You can't use dump() in system plugins that are run before the J!Dump plugin is run,
so it is best to use ordering in the plugin manager to put J!Dump upfront.

J!Dump requires at least Joomla 2.5.5. If you need compatibility with an older version of J!Dump, please download
[v2012-10-08](https://github.com/downloads/mathiasverraes/jdump/unzip_first_jdump_v2012-10-08.zip).

Contributors


Tips
---------

Tip 1 :
------------
If you want to dump an **SQL query of a Query Object**, JDump won't show anything ! ... you have to use the magic method **__toString()** :

```php
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('id, name, email');
$query->from('#__users');
$query->order('username DESC');

// display the content of an SQL query
dump($query->__toString(), "My SQL query to read users");

```

This will show :
"SELECT id, name, email FROM #__users ORDER BY username DESC"

Tip 2 :
------------
You want to be sure that your web site won't show a fatal error if you forget to remove a dump trace in your code, before running in production ?
In that case, you can add a IF test with 'if(function_exists("dump"))' just before calling "dump()". If the JDump plugin is uninstalled or unpublished, the **dump() method will not be called** :

```php
// ensure dump() is accessible
if(function_exists("dump")) dump($myVar, "My Var is");

```

Tip 3 :
------------
You want to get the **file path of a PHP script that contains a specific object** ?
You can use the implemention of the **Reflection process** (native PHP 5).
Execute the Reflection process on the name of the class set in parameter (ex : JModuleHelper).
Call the JDump method getFileName() method on the resulted object and it's done !

```php
// get the path of a PHP script Object
$ref = new ReflectionClass('JModuleHelper');
dump($ref->getFileName(), 'Reflection Class path for '.$ref->getName());

```
This will show :

![jdump-reflection_class](https://cloud.githubusercontent.com/assets/970021/11407200/92e255ea-93b1-11e5-979e-9ad64dabffd9.png)


Originals Contributors
-------------

- Mathias Verraes (Lead)
Expand All @@ -110,5 +150,5 @@ J!Dump is licensed as GNU/GPL v2.
Credits
-------

This component includes Folder Tree Static by Alf Magne Kalleland. It is released
This component includes Folder Tree Static by Alf Magne Kalleland. It is released
under LGPL and can be found at http://www.dhtmlgoodies.com/

0 comments on commit 466c29f

Please sign in to comment.