<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/two-step-creation-for-php-modules-rmxqtamrs" -->

---
title: Two-step creation for PHP modules | daily.dev
description: A PHP internals mailing list proposal by Alex Rock outlines a two-step approach to adding a native module system to PHP. Step one introduces &#x27;definition files&#x27;...
canonical: https://daily.dev/posts/two-step-creation-for-php-modules-rmxqtamrs
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Two-step creation for PHP modules | daily.dev
og:description: A PHP internals mailing list proposal by Alex Rock outlines a two-step approach to adding a native module system to PHP. Step one introduces &#x27;definition files&#x27;...
og:url: https://daily.dev/posts/two-step-creation-for-php-modules-rmxqtamrs
og:image: https://api.daily.dev/og/posts/rmXqtAmrS.png
og:image:alt: Two-step creation for PHP modules
og:image:width: 1200
og:image:height: 630
og:locale: 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.

# Two-step creation for PHP modules

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

## Summary

A PHP internals mailing list proposal by Alex Rock outlines a two-step approach to adding a native module system to PHP. Step one introduces 'definition files' declared with `declare(def=1)` — files with zero global side effects, containing only declarations (classes, functions, constants, etc.) and no executable statements. Step two builds on this with 'PHP modules' declared via `declare(module=1)`, adding `import` and `export` keywords for explicit, scoped symbol sharing between files. Internal symbols would be hash-prefixed to prevent global namespace pollution, with tree-shaking of unused exports. The proposal also covers Composer integration via a new `spl_register_module()` function and `composer.json` module fields. A proof-of-concept PR for step one already exists. A reply from Rowan Tommins critiques the proposal as too JavaScript-influenced, arguing PHP's architecture is closer to Java/C# and the design doesn't fit PHP's existing ecosystem.

## Full article

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

## Similar posts on daily.dev

- [Two-step creation for PHP modules](https://daily.dev/posts/two-step-creation-for-php-modules-g7fb2e0uj) · externals.io · 0 upvotes · 0 comments
- [Two-step creation for PHP modules](https://daily.dev/posts/two-step-creation-for-php-modules-xyvwn1fjv) · externals.io · 0 upvotes · 0 comments
- [Two-step creation for PHP modules](https://daily.dev/posts/two-step-creation-for-php-modules-1ltrewsrl) · externals.io · 0 upvotes · 0 comments
- [Two-step creation for PHP modules](https://daily.dev/posts/two-step-creation-for-php-modules-gwqybbgk9) · externals.io · 1 upvotes · 0 comments
- [Two-step creation for PHP modules](https://daily.dev/posts/two-step-creation-for-php-modules-8o6vgn4zv) · externals.io · 0 upvotes · 0 comments

---

Tags: [#general-programming](https://daily.dev/tags/general-programming), [#php](https://daily.dev/tags/php)

[View this post on daily.dev](https://daily.dev/posts/two-step-creation-for-php-modules-rmxqtamrs)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Two-step creation for PHP modules","url":"https://daily.dev/posts/two-step-creation-for-php-modules-rmxqtamrs","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/two-step-creation-for-php-modules-rmxqtamrs"},"datePublished":"2026-06-08T21:14:37.210Z","dateModified":"2026-06-08T21:20:26.842Z","description":"A PHP internals mailing list proposal by Alex Rock outlines a two-step approach to adding a native module system to PHP. Step one introduces 'definition files'...","image":"https://media.daily.dev/image/upload/s--VDukGCjf--/f_auto/v1722860399/public/Placeholder%2002","thumbnailUrl":"https://media.daily.dev/image/upload/s--VDukGCjf--/f_auto/v1722860399/public/Placeholder%2002","isAccessibleForFree":true,"articleSection":"externals.io","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"externals.io","logo":"https://media.daily.dev/image/upload/s--9i0zxASK--/f_auto,q_auto/v1780213616/logos/externals?_a=BAMAMiWQ0","url":"https://daily.dev/sources/externals"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/two-step-creation-for-php-modules-rmxqtamrs","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"general-programming,php","timeRequired":"PT16M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"externals.io","item":"https://daily.dev/sources/externals"},{"@type":"ListItem","position":3,"name":"Two-step creation for PHP modules"}]}
```

