Marco
Marco

Reputation: 2902

Call static method on classes without namspaces

I have a library that don't uses namespaces but uses only static methods, how could I make it available throughout the application? I'm using Symfony 3.2

Upvotes: 1

Views: 75

Answers (1)

Jeremy Harris
Jeremy Harris

Reputation: 24549

This can be done in your composer.json file for autoloading:

"autoload": {
    "files": ["/path/to/my/file/with/functions.php"]
}

Read more: https://codingexplained.com/coding/php/composer-autoloading-third-party-libraries-without-namespaces

Don't forget to run composer dump-autoload to rebuild the cached autoloader.

Upvotes: 5

Related Questions