<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/xjmL1GfFs" -->

---
title: PHP’s Gradual Typing Journey: From Wild West to Almost...
description: PHP's type system evolved over 15+ years from PHP 5's loose type juggling to PHP 8's gradual typing with declare(strict_types=1), union types, readonly...
canonical: https://daily.dev/posts/xjml1gffs
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: PHP’s Gradual Typing Journey: From Wild West to Almost Respectable | daily.dev
og:description: PHP's type system evolved over 15+ years from PHP 5's loose type juggling to PHP 8's gradual typing with declare(strict_types=1), union types, readonly...
og:url: https://daily.dev/posts/xjml1gffs
og:image: https://api.daily.dev/og/posts/xjmL1GfFs.png
og:image:alt: Post cover image
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.

# PHP’s Gradual Typing Journey: From Wild West to Almost Respectable

**[PHP Dev](https://daily.dev/sources/phpdev)** · [@damienseguy](https://daily.dev/damienseguy) · 27 upvotes · 1 comments

## Summary

PHP's type system evolved over 15+ years from PHP 5's loose type juggling to PHP 8's gradual typing with declare(strict_types=1), union types, readonly classes, and property promotion. The piece traces why backwards compatibility forced PHP toward optional, per-file strict typing rather than an all-or-nothing switch, and compares this approach to Python's non-enforced type hints (PEP 484) and TypeScript's separate-language strategy. It argues PHP's runtime-enforced but opt-in model is working, citing Laravel and Symfony's adoption of strict typing, while noting costs like ecosystem fragmentation, cognitive load, and lingering coercive-mode legacy code.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.javacodegeeks.com/2026/01/phps-gradual-typing-journey-from-wild-west-to-almost-respectable.html>

## Similar posts on daily.dev

- [Four out of five](https://daily.dev/posts/four-out-of-five-0p880vrtn) · PHPUnit Expert · 5 upvotes · 1 comments
- [stitcher.io](https://daily.dev/posts/stitcher-io-ydudcmogn) · stitcher.io · 7 upvotes · 2 comments
- [PHP in 2026](https://daily.dev/posts/php-in-2026-lsdo240ed) · stitcher.io · 123 upvotes · 3 comments

---

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

[View this post on daily.dev](https://daily.dev/posts/xjml1gffs)

```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":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/xjml1gffs","headline":"PHP’s Gradual Typing Journey: From Wild West to Almost Respectable","text":"Shared: PHP’s Gradual Typing Journey: From Wild West to Almost Respectable","url":"https://daily.dev/posts/xjml1gffs","datePublished":"2026-08-13T08:26:11.096Z","dateModified":"2026-09-13T21:46:39.683Z","author":{"@type":"Person","name":"Damien seguy","url":"https://daily.dev/damienseguy","image":"https://media.daily.dev/image/upload/s--nPbjKqol--/f_auto,q_auto/v1698422671/avatars/avatar_G85JhYcDxAg024Omc8Rlp","description":"PHP developer passionate about deep language knowledge, testing, static analysis, and sustainable it","worksFor":{"@type":"Organization","name":"Exakat","logo":"https://media.daily.dev/image/upload/s--ibtl6fze--/f_auto/v1749051132/companies/exakat"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":44950}},"image":"https://media.daily.dev/image/upload/s--58gMhC4P--/f_auto/v1722860399/public/Placeholder%2012","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":27},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":1}],"sharedContent":{"@type":"WebPage","url":"https://api.daily.dev/r/Jsny1fN50"},"isPartOf":{"@type":"WebPage","url":"https://daily.dev/squads/phpdev","name":"PHP Dev"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"PHP Dev","item":"https://daily.dev/squads/phpdev"},{"@type":"ListItem","position":3,"name":"PHP’s Gradual Typing Journey: From Wild West to Almost Respectable"}]}
```

