Support the ongoing development of Laravel.io →
posted 10 years ago
Packages
Last updated 2 years ago.
0

Put them anywhere you want.

I would suggest you put them in app/helpers.php and then require that file in app/start/global.php or add them in app/helpers (new folder) and then autoload that folder with composer.

	"autoload": {
		"classmap": [
			...
			"app/helpers",
			...
		]
	},
Last updated 2 years ago.
0

Great, I'll go with directory version. Thanks!

Last updated 2 years ago.
0

Also consider PSR-4, also in composer.json:

"psr-4" : {
    "YourNamespace\\" : "app/YourNamespace"
}

Don't forget to do composer dump-autoload in the terminal.

You can now drop in classes like this with no manual configuration required, or even touching composer:

// app/YourNamespace/Foo/bar.php

namespace YourNamespace\Foo;
class Bar{}
Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

akalajzi akalajzi Joined 9 Feb 2014

Moderators

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

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.