1

How can I make a php file that I'm including have automatically a certain namespace assigned, without me having to add namespace in the file at the top?

This file would be a "template" used to build the site output..

1 Answer 1

3

This is simply not possible. PHP's namespaces work per-file.

If this is really what you want, you might be able to use code generation to write multiple files with similar content with a different namespace declaration, but you should review your design and perhaps add more details about what you are trying to achieve.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.