sparxstar-gluon

Documentation

Welcome to the SPARXSTAR WordPress Plugin Starter documentation.

Supported Stack

Quick Start

1. Clone and Setup

git clone https://github.com/Starisian-Technologies/sparxstar-gluon.git your-plugin-name
cd your-plugin-name
composer install
npm install

2. Customize Plugin

Update these files with your plugin information:

3. Build Assets

npm run build

4. Develop

# Watch for changes (if you set up watch scripts)
npm run watch

# Or manually build after changes
npm run build

Architecture Overview

┌─────────────────────────────────────────────────────────┐
│                    Plugin Entry Point                    │
│              sparxstar-plugin-entry.php                  │
└─────────────────────┬───────────────────────────────────┘
                      │
                      ▼
┌─────────────────────────────────────────────────────────┐
│                    PSR-4 Autoloader                      │
│              src/includes/Autoloader.php                 │
└─────────────────────┬───────────────────────────────────┘
                      │
        ┌─────────────┼─────────────┐
        ▼             ▼              ▼
    ┌──────┐    ┌─────────┐    ┌──────────┐
    │ Core │    │ Helpers │    │Integration│
    └──────┘    └─────────┘    └──────────┘

Directory Structure

src/
├── core/           # Core plugin functionality
├── helpers/        # Helper classes and utilities
├── includes/       # Autoloader and includes
├── integrations/   # Third-party integrations
├── templates/      # Template files
├── js/            # JavaScript source files
└── css/           # CSS source files

assets/
├── js/            # Minified JavaScript (generated)
└── css/           # Minified CSS (generated)

tests/
├── phpunit/       # PHP unit tests
└── e2e/           # End-to-end tests

.github/workflows/ # CI/CD workflows
docs/              # Documentation

Development Workflow

Daily Development

  1. Write code in src/ directories
  2. Run linters to check code quality
  3. Run tests to verify functionality
  4. Build assets before committing
  5. Commit with conventional commits

Before Committing

# Lint everything
npm run lint
composer run lint:php

# Run tests
npm test
composer run test:php

# Build assets
npm run build

# Commit (husky will run pre-commit hooks)
git commit -m "feat: add new feature"

Standards & Best Practices

PHP Standards

JavaScript Standards

CSS Standards

Testing Strategy

PHP Testing (PHPUnit)

composer run test:php

Test files: tests/phpunit/*Test.php

JavaScript Testing (Jest)

npm test

Test files: src/js/__tests__/*.test.js

E2E Testing (Playwright)

npm run test:e2e

Test files: tests/e2e/*.spec.js

Build Process

JavaScript Build

  1. Source files: src/js/**/*.js
  2. Process: Minify with Terser
  3. Output: assets/js/**/*.min.js
  4. Source maps: Generated

CSS Build

  1. Source files: src/css/**/*.css
  2. Process: Minify with clean-css
  3. Output: assets/css/**/*.min.css

Deployment

Push a version tag:

git tag -a v1.2.3 -m "Release 1.2.3"
git push origin v1.2.3

GitHub Actions will:

Manual

See BUILD.md for manual deployment steps.

Troubleshooting

Common Issues

Problem: Build fails with “command not found”
Solution: Run npm install to install dependencies

Problem: PHPStan errors after update
Solution: Regenerate baseline: ./vendor/bin/phpstan analyse --generate-baseline

Problem: Tests fail in CI but pass locally
Solution: Check PHP version compatibility (CI tests PHP 8.2, 8.3, 8.4)

Getting Help

Additional Resources

When to Fork vs. Extend

Fork This Repository When:

Use as Template When:

Extend When:

Contributing

See CONTRIBUTING.md for contribution guidelines.

First-time contributors should read FIRST_CONTRIBUTION.md.

License

This template is licensed under the MIT License. See LICENSE.md.

Projects built with this template can use any license.