A comprehensive, open-source learning platform helping developers fall in love with PHP and its ecosystem.
🌐 Live Site: codewithphp.com
👤 Author: Dale Hurley
📄 License: MIT
Code with PHP is a tutorial-based learning resource featuring hands-on, reproducible tutorials for modern PHP development. Every code sample is tested, every chapter is production-ready, and every tutorial is designed to teach real-world skills.
- PHP Basics — Master PHP fundamentals from zero to hero
- AI/ML for PHP Developers — Build machine learning applications with PHP
- Build a CRM with Laravel 12 — Build a complete CRM system with Laravel 12
- Claude for PHP Developers — Integrate Claude AI into PHP applications
- Data Science for PHP Developers — Data analysis and visualization with PHP
- PHP Algorithms — Master algorithms and data structures in PHP
- PHP for Java Developers — Transition from Java to PHP
- PHP for TypeScript Developers — Transition from TypeScript to PHP
- Python Developers ♥ PHP & Laravel — Transition from Python to PHP/Laravel
- Ruby on Rails Developers ♥ Laravel — Transition from Rails to Laravel
# Install dependencies
npm install
# Start development server (http://localhost:4321)
npm run dev
# Build for production
npm run build
# Preview production build
npm run previewAll tutorial code is validated in the testing/ directory before publication.
cd testing
# Run all tests
php test-all-samples.php
# View test results
cat TEST-SUMMARY-REPORT.mdCurrent Test Status: 96/119 passing (80.7%) 🎉
PHP-From-Scratch/
├── src/ # Astro Starlight documentation site
│ ├── content/
│ │ ├── docs/ # Tutorial content
│ │ │ ├── index.mdx # Landing page
│ │ │ └── series/ # Tutorial series content
│ │ │ ├── php-basics/
│ │ │ ├── ai-ml-php-developers/
│ │ │ ├── build-crm-laravel-12/
│ │ │ ├── claude-php-developers/
│ │ │ ├── data-science-php-developers/
│ │ │ ├── php-algorithms/
│ │ │ ├── php-for-java-developers/
│ │ │ ├── php-typescript-developers/
│ │ │ ├── python-developers-love-php-laravel/
│ │ │ └── rails-developers-love-laravel/
│ │ └── config.ts # Content collections configuration
│ ├── styles/ # Custom CSS
│ └── Head.astro # Custom head component
│
├── code/ # Executable code samples (organized by series)
│ ├── php-basics/
│ ├── ai-ml-php-developers/
│ └── [other series]/
│
├── testing/ # Test infrastructure for code validation
│ ├── test-all-samples.php
│ └── TEST-SUMMARY-REPORT.md
│
├── imagen/ # AI image generation (MCP server)
│ ├── src/ # Gemini 2.5 Flash integration
│ └── output/ # Generated hero images
│
├── public/ # Static assets
│ ├── images/ # Hero images and graphics
│ └── social/ # Social media preview images
│
├── scripts/ # Utility scripts
│ ├── generate-social-images.js
│ └── update-code-references.js
│
└── astro.config.mjs # Astro & Starlight configuration
- Astro 5 — Modern static site generator with component islands
- Starlight — Astro's documentation theme with built-in features
- TypeScript — Type-safe configuration
- MDX — Enhanced markdown with component support
- GitHub Pages — Hosting & deployment
- Google Gemini 2.5 Flash — AI image generation
- MCP (Model Context Protocol) — Claude Desktop integration
- Node.js — Image processing pipeline
We welcome contributions! Here's how to get started:
-
Content Contributions
- Edit pages via the "Edit this page" link on any chapter
- Follow authoring guidelines in
.cursor/rules/ - All code samples must pass tests in
testing/
-
Code Quality Standards
- PHP 8.4+ compatible
- PSR-12 coding standards
- Complete, runnable examples (no partial code)
- Proper error handling and type hints
-
Testing Requirements
- Copy code to
testing/<series-name>/ - Run
php test-all-samples.php - Document expected failures if applicable
- Copy code to
Key rules documents:
- tutorials-global.mdc — Global writing standards
- authoring-guidelines.mdc — Tutorial structure & patterns
- astro.config.mjs — Astro & Starlight configuration
- ✅ Progress Tracking — Built-in chapter completion tracking
- 🔍 Full-Text Search — Search across all tutorials
- 📱 Mobile-Friendly — Responsive design for learning on the go
- 🎯 Hands-On Code — Every example is tested and runnable
- 🔗 Deep Linking — Share specific sections with others
- 🧪 Automated Testing — Validate all code samples before publish
- 🎨 Image Generation — AI-generated hero images for chapters
- 🔄 Real-Time Preview — See changes instantly
- Website: codewithphp.com
- Repository: github.com/dalehurley/codewithphp
- Author: dalehurley.com
- Astro: astro.build
- Starlight: starlight.astro.build
- PHP Documentation: php.net
- PHP Basics: ✅ Complete (25 chapters)
- AI/ML for PHP Developers: ✅ Complete (25 chapters)
- Build a CRM with Laravel 12: 🚧 In Progress (40 chapters planned)
- Claude for PHP Developers: 🚧 In Progress (40 chapters planned)
- Data Science for PHP Developers: 🆕 Starting
- PHP Algorithms: 🚧 In Progress (38 chapters planned)
- PHP for Java Developers: 🚧 In Progress (23 chapters planned)
- PHP for TypeScript Developers: 🆕 Starting (16 chapters planned)
- Python → PHP/Laravel: 🚧 In Progress (11 chapters)
- Rails → Laravel: 🚧 In Progress (11 chapters)
- Code Test Coverage: 80.7% passing (96/119 samples)
- Active Development: ✅ Ongoing
MIT License — See LICENSE for details.
Built with ❤️ by Dale Hurley