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