PHP code example of arielenter / laravel-code-snippets

1. Go to this page and download the library: Download arielenter/laravel-code-snippets library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

arielenter / laravel-code-snippets example snippets


/**
 * A ‘README.md’ is created using a template file for the given language.
 *
 * The function ‘trans’ or ‘__’ is used to get the resulting
 * ‘readme’ file. With this in mind, the template file must use placeholders
 * in the form of ‘:key_to_translate’ style, and the replace values have to
 * be given in an array where keys are the placeholders and the values are the
 * desired replace text.
 *
 * @param string               $template Path to the template file.
 * @param string               $locale   ISO language code that the resulting
 *                                       readme file is made for, using
 *                                       ‘README.xx.md’ style to name it,
 *                                       unless it’s equal to the
 *                                       application’s current language, in
 *                                       which case ‘README.md’ name is used
 *                                       instead.
 * @param ?int                 $wrap     If an integer is given instead of null,
 *                                       the text inside the resulting
 *                                       ‘readme’ file will be wrapped using
 *                                       this value as the width.
 * @param array<string,string> $replace  Replace values that will be used on the
 *                                       template’s placeholders.
 *
 * @return string The generated content for the file
 */

/**
 * Producess the ‘md’ code corresponding to hyper links for every readme
 * file of every given language.
 *
 * @param array<string,string> $availableLocales ISO code as key and name as
 *                                               value of every available
 *                                               language.
 * @param string               $exception        Optional. ISO code of the 
 *                                               language we might want to leave
 *                                               out.
 * @param string               $separator        Optional. Text that should
 *                                               separate each link. By default
 *                                               it’s ‘ | ’.
 *
 * @return string Hyper links to every README file.
 */

/**
 * Changes the value of the given key. If the key doesn’t exist, it will be
 * added.
 *
 * @param string $key   Key
 * @param string $value Value
 *
 * @return void
 */

/**
 * Asserts that the given closure triggers an asssertion fail error.
 *
 * @param Closure $closure Closure to be tested.
 * @param ?string $failMsg If provided, makes sure that the expected resulting
 *                         assertion fail error throws the expected message.
 *
 * @return void
 */