Skip to content

A modern, AI-enhanced CMS built with CakePHP 5. Features AI-powered SEO optimization, automated translation (25+ languages via Claude & Google Translate), image galleries with AI analysis, hierarchical tagging, and comment moderation. Includes complete Docker dev environment with 290+ tests.

License

Notifications You must be signed in to change notification settings

matthewdeaves/willow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒฟ Willow CMS

A Modern Content Management System Built with CakePHP 5.x and AI Integration

Build Status PHP Version CakePHP License: GPL v3

Coverage PHPStan Code Style Security PHPMD Duplication

View Metrics Dashboard

Willow CMS is a powerful, AI-enhanced content management system that combines the robustness of CakePHP 5.x with cutting-edge AI capabilities. Built with developers in mind, it offers a complete Docker development environment and production-ready features.

๐Ÿ†“ FREE & OPEN SOURCE โ€ข ๐Ÿ”ง FULLY CUSTOMIZABLE

๐Ÿš€ Live Demo | ๐Ÿ“– Development Blog | ๐Ÿ“„ GPL-3.0 License


โœจ Key Features

๐Ÿค– AI-Powered Content Management

  • Automatic Translation: Support for 25+ languages with AI and Google Translate integration
  • SEO Optimization: AI-generated meta titles, descriptions, and social media content
  • Smart Tagging: Automatic article tagging based on content analysis
  • Image Analysis: AI-powered alt text, keywords, and descriptions for images
  • Comment Moderation: Intelligent spam and inappropriate content detection
  • Content Generation: AI-powered article summaries and content enhancement

๐ŸŽจ Flexible Architecture

  • Plugin-Based Theming: Separate frontend (DefaultTheme) and admin (AdminTheme) interfaces
  • Multi-Language First: Built-in internationalization with locale-aware routing
  • Queue-Based Processing: Background jobs for heavy operations (image processing, AI tasks)
  • Modern Security: IP blocking, rate limiting, CSRF protection, and secure authentication
  • Advanced Content Management: WYSIWYG editor (Trumbowyg) with image galleries and responsive design
  • Image Gallery System: Comprehensive image management with AI-powered descriptions and metadata

๐Ÿ› ๏ธ Developer Experience

  • Docker Development Environment: Complete setup with Nginx, PHP, MySQL, Redis, PHPMyAdmin, Mailpit, and Jenkins
  • Management Tool: Interactive CLI (./manage.sh) for data management, backups, and system operations
  • Code Quality Tools: PHP CodeSniffer, PHPStan, and comprehensive unit testing with 292+ tests
  • CakePHP 5.x Foundation: Following modern MVC patterns and conventions
  • Developer Aliases: Streamlined shell commands for common development tasks
  • GitHub Actions CI/CD: Automated testing on PHP 8.1, 8.2, 8.3 with Redis integration

๐Ÿš€ Quick Start

Prerequisites

  • Docker (only requirement on your host machine)
  • Git

Installation

# Clone the repository
git clone git@github.com:matthewdeaves/willow.git
cd willow/

# Run the setup script
./setup_dev_env.sh

๐ŸŽ‰ That's it! Your development environment is ready:

Additional Services


๐Ÿ”ง Development Workflow

Developer Aliases

Install helpful shell aliases for streamlined development:

./setup_dev_aliases.sh

This provides shortcuts like:

  • cake_queue_worker - Start background job processing
  • phpunit - Run all tests
  • phpcs_sniff - Check code standards
  • phpcs_fix - Auto-fix code violations

Essential Commands

Queue Workers (Required for AI Features)

# Start queue worker for AI processing, image handling, etc.
cake_queue_worker_verbose
# or
docker compose exec willowcms bin/cake queue worker --verbose

Testing

# Run all tests (292+ tests with comprehensive coverage)
phpunit

# Run with coverage report
phpunit_cov_html
# Accessible at http://localhost:8080/coverage/

# Run specific test file
phpunit tests/TestCase/Controller/UsersControllerTest.php

Code Quality

# Check coding standards
phpcs_sniff

# Auto-fix code violations
phpcs_fix

# Static analysis (PHPStan level 5)
phpstan_analyse

# All quality checks
composer cs-check && composer stan

Database Management

# Run migrations
cake_migrate

# Create migration after schema changes
bake_diff YourMigrationName

# Direct database access
docker compose exec mysql mysql -u cms_user -ppassword cms

Management Tool

The interactive management tool provides easy access to common tasks:

./manage.sh

Features:

  • ๐Ÿ“Š Database backups and restoration
  • ๐ŸŒ Internationalization management
  • ๐Ÿ“ File backup and restoration
  • ๐Ÿงน Cache clearing and system maintenance
  • ๐Ÿ”ง Interactive container shell access

๐Ÿค– AI Integration Setup

Willow CMS integrates with leading AI services for enhanced functionality:

AI Providers

Choose between two AI providers:

Anthropic Claude API (Direct)

  • Native integration with Claude models
  • Direct API access for lowest latency
  • Requires Anthropic API key

OpenRouter

  • Access to multiple AI providers through one API
  • Use Claude, GPT-4, Gemini, Llama, and more
  • Flexible model selection per task
  • Requires OpenRouter API key

AI Features

  • Content analysis and generation
  • SEO optimization (meta titles, descriptions, keywords)
  • Image analysis (alt text, keywords)
  • Comment moderation and spam detection
  • Article summarization and tag generation
  • Social media descriptions (Facebook, Twitter, LinkedIn, Instagram)

Google Translate API

  • Professional-grade translations
  • Batch processing support
  • 25+ language support

Configuration

  1. Navigate to Settings: http://localhost:8080/admin/settings
  2. Select your AI provider (Anthropic or OpenRouter)
  3. Add your API keys:
    • Anthropic API key (for direct access)
    • OpenRouter API key (for OpenRouter provider)
    • Google Translate API key
  4. Configure models per task in AI Prompts (Admin > AI Prompts)
  5. Enable AI features and select desired languages
  6. Start a queue worker to process AI jobs

๐Ÿ—๏ธ Architecture Overview

Core Technologies

  • Framework: CakePHP 5.x
  • Database: MySQL 8.0+
  • Cache/Queue: Redis
  • Container: Docker + Alpine Linux
  • Web Server: Nginx + PHP-FPM

Project Structure

willow/
โ”œโ”€โ”€ ๐Ÿ“ src/                          # Core application code
โ”‚   โ”œโ”€โ”€ ๐ŸŽฎ Controller/              # Frontend controllers
โ”‚   โ”‚   โ””โ”€โ”€ Admin/                  # Admin backend controllers
โ”‚   โ”œโ”€โ”€ ๐Ÿ“Š Model/                   # Data models, entities, and behaviors
โ”‚   โ”‚   โ”œโ”€โ”€ Behavior/              # Reusable model behaviors
โ”‚   โ”‚   โ”œโ”€โ”€ Entity/                # Entity classes with business logic
โ”‚   โ”‚   โ””โ”€โ”€ Table/                 # Table classes with queries
โ”‚   โ”œโ”€โ”€ ๐Ÿ”Œ Service/Api/             # AI and external API integrations
โ”‚   โ”‚   โ”œโ”€โ”€ Anthropic/             # Claude AI services (direct)
โ”‚   โ”‚   โ”œโ”€โ”€ OpenRouter/            # OpenRouter API services
โ”‚   โ”‚   โ””โ”€โ”€ Google/                # Google Translate services
โ”‚   โ”œโ”€โ”€ โšก Job/                     # Background job classes
โ”‚   โ”œโ”€โ”€ ๐Ÿ› ๏ธ Command/                 # CLI command tools
โ”‚   โ”œโ”€โ”€ ๐Ÿ›ก๏ธ Middleware/              # Security and rate limiting
โ”‚   โ”œโ”€โ”€ ๐Ÿ‘๏ธ View/                    # View helpers and cells
โ”‚   โ””โ”€โ”€ ๐Ÿ”ง Utility/                 # Helper and utility classes
โ”œโ”€โ”€ ๐ŸŽจ plugins/                     # Plugin-based themes
โ”‚   โ”œโ”€โ”€ AdminTheme/                # Administrative interface (Bootstrap)
โ”‚   โ”‚   โ”œโ”€โ”€ src/                   # Plugin controllers and logic
โ”‚   โ”‚   โ”œโ”€โ”€ templates/             # Admin templates and forms
โ”‚   โ”‚   โ””โ”€โ”€ webroot/               # Admin assets (CSS, JS)
โ”‚   โ””โ”€โ”€ DefaultTheme/              # Public website theme
โ”‚       โ”œโ”€โ”€ src/                   # Theme controllers
โ”‚       โ”œโ”€โ”€ templates/             # Public templates
โ”‚       โ””โ”€โ”€ webroot/               # Public assets
โ”œโ”€โ”€ โš™๏ธ config/                      # Configuration files
โ”‚   โ”œโ”€โ”€ Migrations/                # Database migration files
โ”‚   โ”œโ”€โ”€ schema/                    # Database schema files
โ”‚   โ””โ”€โ”€ routes.php                 # URL routing configuration
โ”œโ”€โ”€ ๐Ÿงช tests/                       # Comprehensive test suite (292+ tests)
โ”‚   โ”œโ”€โ”€ TestCase/                  # Test classes
โ”‚   โ””โ”€โ”€ Fixture/                   # Test data fixtures
โ”œโ”€โ”€ ๐Ÿณ docker/                      # Docker development environment
โ”œโ”€โ”€ ๐Ÿ“ webroot/                     # Public web assets and uploads
โ”œโ”€โ”€ ๐ŸŒ resources/locales/           # Translation files (25+ languages)
โ””โ”€โ”€ ๐Ÿ”ง manage.sh                    # Interactive management tool

Key Behaviors & Components

  • ImageAssociableBehavior: Cross-model image associations via pivot table
  • SlugBehavior: SEO-friendly URLs with history tracking and automatic redirects
  • OrderableBehavior: Drag-and-drop content ordering for galleries and lists
  • CommentableBehavior: Universal commenting system with AI moderation
  • QueueableImageBehavior: Automated background image processing and analysis
  • ContentHelper: Advanced content formatting with alignment and responsive images
  • GalleryCell: Reusable gallery display component with translation support

๐Ÿงช Testing & Quality

Continuous Integration

  • GitHub Actions: Automated testing on PHP 8.1, 8.2, 8.3 with Redis and MySQL
  • Code Coverage: HTML reports available at /coverage/ with detailed metrics
  • Pre-commit Hooks: Automatic test execution and code quality checks before pushes
  • 292+ Tests: Comprehensive test suite covering controllers, models, behaviors, and services

Code Standards

  • PHP CodeSniffer: CakePHP coding standards enforcement
  • PHPStan: Static analysis (level 5)
  • Unit Tests: Comprehensive test coverage with fixtures

Running Tests

# All tests
docker compose exec willowcms php vendor/bin/phpunit

# Specific test file
docker compose exec willowcms php vendor/bin/phpunit tests/TestCase/Controller/UsersControllerTest.php

# With coverage report
docker compose exec willowcms php vendor/bin/phpunit --coverage-html webroot/coverage

๐ŸŒ Multi-Language Support

Willow CMS is built with internationalization as a core feature:

Supported Languages

Over 25 languages including English, Spanish, French, German, Chinese, Japanese, and more.

Features

  • Automatic Translation: AI-powered content translation
  • Locale-Aware Routing: Language-specific URLs
  • SEO Translation: Meta content in multiple languages
  • Content Localization: Articles, tags, and UI elements

Commands

# Extract translatable strings
docker compose exec willowcms bin/cake i18n extract

# Generate translation files
docker compose exec willowcms bin/cake generate_po_files

# Import default translations
docker compose exec willowcms bin/cake load_default_18n

๐Ÿšข Production Deployment

For production environments, we provide a separate deployment repository optimized for AWS AppRunner:

๐Ÿ“ฆ Production Deployment Guide

Production Features

  • Optimized Performance: Redis caching, query optimization
  • Security Hardened: Production-ready security configurations
  • Scalable Architecture: Cloud-native deployment patterns
  • Monitoring: Built-in logging and performance monitoring

๐Ÿ“š Documentation

Key Documentation Sections

  1. Getting Started: Shell aliases, project structure, and conventions
  2. Feature Development: Database migrations and best practices
  3. Testing: Unit tests, coverage reports, and CI/CD
  4. AI Integration: Service classes and API configurations
  5. Environment Setup: Docker configuration and deployment

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

Development Process

  1. Fork the repository
  2. Create a feature branch
  3. Follow coding standards (use phpcs_sniff and phpcs_fix)
  4. Write tests for new features
  5. Submit a pull request

Code Standards

  • Follow CakePHP 5.x conventions
  • Maintain test coverage above 80%
  • Use meaningful commit messages
  • Document new features

๐Ÿ“„ License

Willow CMS is released under the GNU General Public License v3.0.

See the LICENSE file for complete details.


๐Ÿ†˜ Support


๐Ÿ™ Acknowledgments

  • CakePHP: The robust PHP framework powering Willow CMS
  • Anthropic: AI capabilities via Claude API
  • OpenRouter: Multi-provider AI API gateway
  • Google Cloud: Translation services
  • Community: All contributors and users who make this project possible

๐ŸŒฟ Built with passion for the web development community

About

A modern, AI-enhanced CMS built with CakePHP 5. Features AI-powered SEO optimization, automated translation (25+ languages via Claude & Google Translate), image galleries with AI analysis, hierarchical tagging, and comment moderation. Includes complete Docker dev environment with 290+ tests.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •