---
title: "Namespace Load event"
url: https://daily.dev/posts/namespace-load-event-s6wawfbra
source_url: https://externals.io/message/131731
type: article
source: "externals.io"
published: 2026-07-03T13:00:11.064Z
updated: 2026-07-03T13:10:30.508Z
tags: ["php"]
reading_time: 9
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Namespace Load event

**[externals.io](https://daily.dev/sources/externals)** · 9 min read · 0 upvotes · 0 comments

## Summary

A pre-RFC discussion on the PHP internals mailing list proposes a new namespace load event mechanism: a callback registered via spl_namespace_register() that fires the first time PHP encounters a namespace declaration. The idea would allow functions and constants within a namespace to be declared before they are called, potentially enabling namespace-level autoloading without requiring one file per function. The thread explores open questions around callback invocation order for nested namespaces (e.g., Foo\Bar\Baz), how use statements should interact with the hook, wildcard loading syntax (use A\*), and how the engine could track already-initialized namespaces via callback return values. A respondent notes that existing tools like the Moto autoloader already support multiple functions per file as an alternative approach.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://externals.io/message/131731>

## Similar posts on daily.dev

- [Namespace Load event](https://daily.dev/posts/namespace-load-event-zrkcxqiyp) · externals.io · 0 upvotes · 0 comments
- [Namespace Load event](https://daily.dev/posts/namespace-load-event-b9mpsoqjg) · externals.io · 0 upvotes · 0 comments
- [Namespace Load event](https://daily.dev/posts/namespace-load-event-gzz2vtie0) · externals.io · 0 upvotes · 0 comments
- [Namespace Load event](https://daily.dev/posts/namespace-load-event-ekzj54f80) · externals.io · 0 upvotes · 0 comments
- [Namespace Load event](https://daily.dev/posts/namespace-load-event-z6s2ggc7i) · externals.io · 0 upvotes · 0 comments

---

Tags: [#php](https://daily.dev/tags/php)

[View this post on daily.dev](https://daily.dev/posts/namespace-load-event-s6wawfbra)
