{"id":32595189,"url":"https://github.com/ghdj/woocker","last_synced_at":"2025-11-02T06:01:20.462Z","repository":{"id":320955552,"uuid":"1083873575","full_name":"GhDj/woocker","owner":"GhDj","description":"🚀 Dockerized WordPress + WooCommerce development environment with Xdebug, WP-CLI, configurable PHP versions, and complete sample data.","archived":false,"fork":false,"pushed_at":"2025-10-27T00:21:21.000Z","size":16,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-27T00:33:51.849Z","etag":null,"topics":["docker","docker-compose","php","plugin-development","woocommerce","wordpress","wordpress-plugin","xdebug"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GhDj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-26T21:51:53.000Z","updated_at":"2025-10-27T00:21:50.000Z","dependencies_parsed_at":"2025-10-27T00:33:58.363Z","dependency_job_id":"d1b6e6a2-bd2a-4de7-b0b0-f717ac0dee79","html_url":"https://github.com/GhDj/woocker","commit_stats":null,"previous_names":["ghdj/woocker"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/GhDj/woocker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GhDj%2Fwoocker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GhDj%2Fwoocker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GhDj%2Fwoocker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GhDj%2Fwoocker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GhDj","download_url":"https://codeload.github.com/GhDj/woocker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GhDj%2Fwoocker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281738464,"owners_count":26552986,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-30T02:00:06.501Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","php","plugin-development","woocommerce","wordpress","wordpress-plugin","xdebug"],"created_at":"2025-10-30T03:33:20.913Z","updated_at":"2025-10-31T04:03:40.401Z","avatar_url":"https://github.com/GhDj.png","language":"Shell","readme":"# WordPress + WooCommerce Development Environment\n\nA complete Dockerized development environment for WordPress and WooCommerce plugin development, ready for testing and debugging.\n\n## Features\n\n- ✅ WordPress with WooCommerce pre-installed\n- ✅ Storefront theme (WooCommerce's official theme)\n- ✅ Sample products of all WooCommerce product types\n- ✅ Xdebug configured for step-by-step debugging\n- ✅ PHPUnit ready for unit and integration testing\n- ✅ MySQL database with PHPMyAdmin\n- ✅ Fully configurable via `.env` file\n- ✅ Local plugin development with live sync\n\n## Prerequisites\n\n- Docker Desktop installed and running\n- Docker Compose v2.0+\n- Git\n- 4GB+ RAM available for Docker\n\n## Quick Start\n\n```bash\n# Run the automated setup\n./setup.sh\n```\n\nThat's it! The setup script will:\n- Create environment configuration\n- Build Docker containers with your chosen PHP version\n- Install WordPress\n- Install and configure WooCommerce\n- Install Storefront theme\n- Create sample products (all product types)\n- Create sample customers\n- Configure Xdebug for debugging\n\n## Access Your Site\n\nAfter setup completes:\n\n- **Frontend**: http://wooco.localhost:8000 (or your configured hostname)\n- **Admin**: http://wooco.localhost:8000/wp-admin\n- **PHPMyAdmin**: http://localhost:8080\n\n**Default Login:**\n- Username: `admin`\n- Password: `admin123`\n\n**Note:** `*.localhost` domains work without editing `/etc/hosts` on most systems. You can customize the hostname in `.env`.\n\n## Project Structure\n\n```\nwoocker/\n├── setup.sh                  # Automated setup script\n├── docker-compose.yml        # Docker services configuration\n├── Dockerfile                # WordPress container with Xdebug\n├── .env                      # Environment variables (create from .env.example)\n├── .env.example              # Environment template\n├── .gitignore                # Git ignore rules\n├── wordpress/                # Full WordPress installation (mounted)\n│   ├── wp-admin/            # WordPress admin\n│   ├── wp-includes/         # WordPress core\n│   ├── wp-content/\n│   │   ├── plugins/        # Your custom plugins go here\n│   │   │   └── your-plugin/\n│   │   │       ├── your-plugin.php\n│   │   │       ├── tests/   # Plugin-specific tests\n│   │   │       └── phpunit.xml\n│   │   ├── themes/         # WordPress themes\n│   │   └── uploads/        # Media uploads\n│   └── wp-config.php       # WordPress configuration\n└── scripts/\n    └── setup-sample-data.sh\n```\n\n## Plugin Development\n\n### Adding Your Plugin\n\nThe entire WordPress installation is in the `./wordpress/` directory and is synchronized with the Docker container in real-time.\n\n1. Create your plugin directory:\n   ```bash\n   mkdir -p wordpress/wp-content/plugins/my-plugin\n   ```\n\n2. Create your main plugin file:\n   ```bash\n   cat \u003e wordpress/wp-content/plugins/my-plugin/my-plugin.php \u003c\u003cEOF\n   \u003c?php\n   /**\n    * Plugin Name: My Plugin\n    * Description: My awesome WooCommerce plugin\n    * Version: 1.0.0\n    */\n\n   add_action('init', function() {\n       // Your code here\n   });\n   EOF\n   ```\n\n3. The plugin is immediately available in WordPress admin → Plugins!\n\n### File Synchronization\n\nThe entire `./wordpress/` directory is mounted to `/var/www/html` in the container.\n\n**This means:**\n- Edit files locally with your favorite IDE\n- Changes are instantly reflected in WordPress\n- No need to rebuild Docker containers\n- Full access to all WordPress files\n\n### Tracking Your Plugin in Git\n\nBy default, the entire `wordpress/` directory is gitignored. To track your custom plugin:\n\nAdd this to `.gitignore`:\n```gitignore\n!wordpress/wp-content/plugins/my-plugin/\n```\n\nThis allows you to version control your plugin while ignoring WordPress core and other plugins.\n\n## Configuration\n\n### Environment Variables (.env)\n\nCustomize your environment by editing `.env`:\n\n```env\n# PHP version (7.4, 8.0, 8.1, 8.2, 8.3)\nPHP_VERSION=8.1\n\n# WordPress version\nWORDPRESS_VERSION=6.4\n\n# WooCommerce version\nWOOCOMMERCE_VERSION=8.5.2\n\n# Database credentials\nMYSQL_ROOT_PASSWORD=rootpassword\nMYSQL_DATABASE=wordpress\nMYSQL_USER=wordpress\nMYSQL_PASSWORD=wordpress\n\n# Custom hostname (*.localhost works without /etc/hosts changes)\nWORDPRESS_HOSTNAME=wooco.localhost\nWORDPRESS_PORT=8000\nWP_SITE_URL=http://wooco.localhost:8000\n\n# Admin credentials\nWP_ADMIN_USER=admin\nWP_ADMIN_PASSWORD=admin123\nWP_ADMIN_EMAIL=admin@example.local\n\n# Xdebug settings\nXDEBUG_MODE=debug\nXDEBUG_CLIENT_HOST=host.docker.internal\nXDEBUG_CLIENT_PORT=9003\nXDEBUG_IDE_KEY=PHPSTORM\n```\n\n### Changing PHP Version\n\n1. Edit `.env` and change `PHP_VERSION` (e.g., `PHP_VERSION=8.2`)\n2. Rebuild and restart:\n   ```bash\n   docker-compose down\n   docker-compose build --no-cache\n   docker-compose up -d\n   ```\n\n### Custom Hostname\n\nUse any hostname you want:\n- `wooco.localhost` (recommended - works without /etc/hosts)\n- `myshop.local` (requires /etc/hosts entry: `127.0.0.1 myshop.local`)\n- `dev.example.com` (requires DNS or /etc/hosts)\n\nAfter changing hostname:\n```bash\ndocker-compose down\ndocker-compose up -d\nwp search-replace 'old-url.com' 'new-url.com' --allow-root\n```\n\n## Development Tools\n\n### WP-CLI\n\nRun WordPress commands directly:\n\n```bash\n# List all plugins\ndocker-compose exec wordpress wp plugin list\n\n# List all users\ndocker-compose exec wordpress wp user list\n\n# Create a new post\ndocker-compose exec wordpress wp post create --post_title=\"Hello\" --post_status=publish\n\n# Export database\ndocker-compose exec wordpress wp db export backup.sql\n\n# Clear cache\ndocker-compose exec wordpress wp cache flush\n```\n\n### Xdebug Setup\n\n#### VS Code\n\n1. Install the \"PHP Debug\" extension\n2. A `.vscode/launch.json` file is created automatically\n3. Press `F5` to start listening for Xdebug\n4. Add breakpoints in your plugin code\n5. Visit your site with `?XDEBUG_TRIGGER=1` in the URL\n\nExample: `http://wooco.localhost:8000/?XDEBUG_TRIGGER=1` (or your configured hostname)\n\n#### PhpStorm\n\n1. Go to Settings → PHP → Debug\n2. Set Xdebug port to `9003`\n3. Configure path mappings:\n   - `./wordpress` → `/var/www/html`\n4. Click \"Start Listening for PHP Debug Connections\"\n5. Visit your site with `?XDEBUG_TRIGGER=1` in the URL\n\n## Testing\n\nThe environment is ready for testing, but tests should be within each plugin.\n\n### Setting Up Plugin Tests\n\n1. **Install test dependencies in your plugin:**\n   ```bash\n   cd wordpress/wp-content/plugins/your-plugin\n   composer require --dev phpunit/phpunit wp-phpunit/wp-phpunit\n   ```\n\n2. **Create `phpunit.xml` in your plugin directory:**\n   ```xml\n   \u003c?xml version=\"1.0\"?\u003e\n   \u003cphpunit bootstrap=\"tests/bootstrap.php\"\u003e\n       \u003ctestsuites\u003e\n           \u003ctestsuite name=\"Plugin Tests\"\u003e\n               \u003cdirectory\u003e./tests\u003c/directory\u003e\n           \u003c/testsuite\u003e\n       \u003c/testsuites\u003e\n   \u003c/phpunit\u003e\n   ```\n\n3. **Create `tests/bootstrap.php`:**\n   ```php\n   \u003c?php\n   // Load WordPress test environment\n   require_once '/tmp/wordpress-tests-lib/includes/bootstrap.php';\n\n   // Load your plugin\n   require_once dirname(__DIR__) . '/your-plugin.php';\n   ```\n\n4. **Run tests:**\n   ```bash\n   # From host\n   docker-compose exec wordpress bash -c \"cd /var/www/html/wp-content/plugins/your-plugin \u0026\u0026 vendor/bin/phpunit\"\n\n   # Or from inside container\n   docker-compose exec wordpress bash\n   cd /var/www/html/wp-content/plugins/your-plugin\n   vendor/bin/phpunit\n   ```\n\n## Sample Data\n\nThe environment includes these WooCommerce product types:\n\n- **Simple Product**: Classic cotton t-shirt\n- **Variable Product**: Premium t-shirt with size and color variations\n- **Grouped Product**: Complete outfit bundle\n- **External/Affiliate Product**: Designer jacket (external link)\n- **Virtual Product**: Online coding course\n- **Downloadable Product**: WordPress development eBook\n- **Additional Products**: Jeans, wallet, shoes, sunglasses\n\n**Sample Customers:**\n- John Doe (john.doe@example.com / customer123)\n- Jane Smith (jane.smith@example.com / customer123)\n\nView products: http://wooco.localhost:8000/wp-admin/edit.php?post_type=product\nView customers: http://wooco.localhost:8000/wp-admin/admin.php?page=wc-admin\u0026path=/customers\n\n### Adding More Sample Data\n\n```bash\n# Import WooCommerce sample data\ndocker-compose exec wordpress wp plugin install wordpress-importer --activate\ndocker-compose exec wordpress wp import wp-content/plugins/woocommerce/sample-data/sample_products.xml --authors=create\n```\n\n## Common Commands\n\n```bash\n# Start environment\ndocker-compose up -d\n\n# Stop environment\ndocker-compose down\n\n# Stop and remove all data (fresh start)\ndocker-compose down -v\n\n# View logs\ndocker-compose logs -f wordpress\n\n# Access WordPress container shell\ndocker-compose exec wordpress bash\n\n# Rebuild containers\ndocker-compose up -d --build\n\n# Check container status\ndocker-compose ps\n```\n\n## Troubleshooting\n\n### Port 8000 already in use\n\nEdit `.env` and change `WORDPRESS_PORT` to another port (e.g., 8001):\n```env\nWORDPRESS_PORT=8001\n```\n\nThen restart:\n```bash\ndocker-compose down\ndocker-compose up -d\n```\n\n### Can't access the site\n\n```bash\n# Check if containers are running\ndocker-compose ps\n\n# View WordPress logs\ndocker-compose logs wordpress\n\n# Restart containers\ndocker-compose restart\n```\n\n### Database connection error\n\n```bash\n# Restart database\ndocker-compose restart db\n\n# Check database health\ndocker-compose exec db mysqladmin ping -h localhost -u root -p\n```\n\n### Xdebug not working\n\n1. Verify Xdebug is installed:\n   ```bash\n   docker-compose exec wordpress php -v\n   ```\n   You should see \"with Xdebug\" in the output.\n\n2. Check Xdebug configuration:\n   ```bash\n   docker-compose exec wordpress php -i | grep xdebug\n   ```\n\n3. For Linux users, change `XDEBUG_CLIENT_HOST` in `.env`:\n   ```env\n   XDEBUG_CLIENT_HOST=172.17.0.1\n   ```\n\n### Permission issues\n\n```bash\n# Fix file permissions\ndocker-compose exec wordpress chown -R www-data:www-data /var/www/html/wp-content\n```\n\n### Start fresh\n\n```bash\n# Remove everything and start over\ndocker-compose down -v\nrm .env\n./setup.sh\n```\n\n## Docker Services\n\n### WordPress Container\n- **Configurable PHP version** (7.4, 8.0, 8.1, 8.2, 8.3)\n- Apache web server\n- Xdebug 3.2 pre-installed\n- WP-CLI pre-installed\n- Composer pre-installed\n- Port 8000 (configurable)\n\n### MySQL Container\n- MySQL 8.0\n- Port 3306 (internal)\n- Persistent data volume\n- Automatic health checks\n\n### PHPMyAdmin Container\n- Web-based database management\n- Port 8080\n- Access: http://localhost:8080\n\n## Best Practices\n\n1. **Version Control**: Commit your plugin code, not WordPress core\n2. **Environment Variables**: Never commit `.env` file\n3. **Database Backups**: Export database regularly during development\n   ```bash\n   docker-compose exec wordpress wp db export backup-$(date +%Y%m%d).sql\n   ```\n4. **Keep Updated**: Update WordPress, WooCommerce, and PHP versions regularly\n5. **Use WP-CLI**: Automate repetitive tasks with WP-CLI scripts\n6. **Write Tests**: Maintain good test coverage for your plugins\n\n## Additional Resources\n\n- [WordPress Developer Resources](https://developer.wordpress.org/)\n- [WooCommerce Developer Documentation](https://woocommerce.com/documentation/plugins/woocommerce/)\n- [WP-CLI Documentation](https://wp-cli.org/)\n- [PHPUnit Documentation](https://phpunit.de/documentation.html)\n- [Xdebug Documentation](https://xdebug.org/docs/)\n\n## License\n\nMIT License - Feel free to use this for your projects!\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghdj%2Fwoocker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghdj%2Fwoocker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghdj%2Fwoocker/lists"}