0
votes

I'd like to play a bit with functional programming in PHP. I think it's intersting to try out something different when always writing oop in php.

However, I'd like to use namespaces. My namespaces are equal to the file structure:

namespace my\Models\User;

/my/Models/User.php

Is their a way to do something like autoloading for this. That I want have to write both use and require_once?

Best regards, Sebastian

1
Beware of Cargo Cult programming. Just because PHP has namespaces now, doesn't mean they have to be used excessively. A 1:1 mapping to directory structures is usually a code smell here. - mario

1 Answers

1
votes

You cannot autoload functions or namespaces, only classes.