Skip to content

Instantly share code, notes, and snippets.

@mabasic
Last active February 3, 2025 19:47
Show Gist options
  • Save mabasic/21d13eab12462e596120 to your computer and use it in GitHub Desktop.
Save mabasic/21d13eab12462e596120 to your computer and use it in GitHub Desktop.

Revisions

  1. Mario Bašić revised this gist Sep 25, 2016. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions instructions.md
    Original file line number Diff line number Diff line change
    @@ -2,11 +2,13 @@

    Create a file called `helpers.php` in the `app/` directory. Paste the code inside it.

    Go to `composer.json` and add to `autoload`:
    Go to `composer.json` and add `files` to `autoload` so that it looks like this:

    ```json
    "autoload": {
    ...
    "psr-4": {
    "App\\": "app/"
    },
    "files": [
    "app/helpers.php"
    ]
  2. Mario Bašić revised this gist Sep 25, 2016. 1 changed file with 16 additions and 0 deletions.
    16 changes: 16 additions & 0 deletions instructions.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    # Instructions

    Create a file called `helpers.php` in the `app/` directory. Paste the code inside it.

    Go to `composer.json` and add to `autoload`:

    ```json
    "autoload": {
    ...
    "files": [
    "app/helpers.php"
    ]
    },
    ```

    Run `composer dump-autoload` to load the newly created helpers file.
  3. Mario Bašić created this gist Jun 22, 2015.
    15 changes: 15 additions & 0 deletions helpers.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    <?php

    if ( ! function_exists('config_path'))
    {
    /**
    * Get the configuration path.
    *
    * @param string $path
    * @return string
    */
    function config_path($path = '')
    {
    return app()->basePath() . '/config' . ($path ? '/' . $path : $path);
    }
    }