├── .editorconfig ├── .gitignore ├── LICENSE.txt ├── README.md ├── composer.json └── src └── helper.php /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | [*] 7 | charset = utf-8 8 | end_of_line = lf 9 | insert_final_newline = true 10 | indent_style = space 11 | indent_size = 4 12 | trim_trailing_whitespace = true 13 | 14 | [*.md] 15 | trim_trailing_whitespace = false 16 | 17 | [*.yml] 18 | indent_style = space 19 | indent_size = 2 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Please do not use this ignore file to define platform specific files. 2 | # 3 | # For these purposes create a global .gitignore file, which is a list of rules 4 | # for ignoring files in every Git repository on your computer. 5 | # 6 | # https://help.github.com/articles/ignoring-files/#create-a-global-gitignore 7 | 8 | /vendor 9 | composer.lock 10 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2016-present, Phalcon Team 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dd 2 | 3 | This library will add the `dd` and `dump` helpers to your Phalcon application. 4 | 5 | ## Install 6 | 7 | Run: 8 | 9 | ```bash 10 | composer require phalcon/dd 11 | ``` 12 | 13 | ## Copyright 14 | 15 | The dd library is open source software licensed under the BSD 3-Clause License. Copyright © 2016-present, Phalcon Team. 16 | See the [LICENSE.txt](./LICENSE.txt) file for more. 17 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "phalcon/dd", 3 | "type": "library", 4 | "description": "This package will add the `dd` and `dump` helpers to your Phalcon application.", 5 | "keywords": [ 6 | "dd", 7 | "dump", 8 | "phalcon", 9 | "utils", 10 | "debug", 11 | "vardumper" 12 | ], 13 | "homepage": "https://github.com/phalcon/dd", 14 | "license": "BSD-3-Clause", 15 | "authors": [ 16 | { 17 | "name": "Phalcon Team", 18 | "email": "team@phalcon.io", 19 | "homepage": "http://phalcon.io/en/team" 20 | }, 21 | { 22 | "name": "Contributors", 23 | "homepage": "https://github.com/phalcon/dd/graphs/contributors" 24 | } 25 | ], 26 | "require": { 27 | "php": "^7.4 || ^8.0", 28 | "ext-phalcon": "^5.0" 29 | }, 30 | "autoload": { 31 | "files": [ 32 | "src/helper.php" 33 | ] 34 | }, 35 | "support": { 36 | "issues": "https://github.com/phalcon/dd/issues", 37 | "forum": "https://github.com/phalcon/cphalcon/discussions/", 38 | "source": "https://github.com/phalcon/dd", 39 | "docs": "https://docs.phalcon.io/", 40 | "rss": "https://blog.phalcon.io/rss" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/helper.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.txt 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use Phalcon\Support\Debug\Dump; 13 | 14 | if (!function_exists('dd')) { 15 | /** 16 | * Dump the passed variables and end the script. 17 | * 18 | * @param mixed 19 | * @return void 20 | */ 21 | function dd() 22 | { 23 | call_user_func_array('dump', func_get_args()); 24 | 25 | die(1); 26 | } 27 | } 28 | 29 | if (!function_exists('dump')) { 30 | /** 31 | * Dump the passed variables without end the script. 32 | * 33 | * @param mixed 34 | * @return void 35 | */ 36 | function dump() 37 | { 38 | array_map(function ($x) { 39 | $string = (new Dump([], true))->variable($x); 40 | 41 | echo (PHP_SAPI == 'cli' ? strip_tags($string) . PHP_EOL : $string); 42 | 43 | }, func_get_args()); 44 | } 45 | } 46 | --------------------------------------------------------------------------------