Global functions

Joe96 posted 2 years ago

Hey, i need to make some functions availabile everywhere: this means i can call them from a controller or a view. How should i proceed?

ITCan replied 2 years ago

In app folder create helpers.php

Then in composer.json change this:

  "autoload": {
    "classmap": [
    "files": [
    "psr-4": {
      "App\\": "app/"

Then do "composer update"

Joe96 replied 2 years ago

Thank you, it worked, but now the page is loading slower, it takes about 3 seconds for it to load, and i'm on localhost. That is way too much

ITCan replied 2 years ago

Ow I didn't experience anything like this, maybe do "composer update -o"

Sign in to participate in this thread!

We'd like to thank these amazing companies for supporting us