snicco/snicco

The development monorepo of the Snicco project

v2.0.0-beta.9 2024-09-07 14:26 UTC

README

codecov Psalm Type-Coverage Psalm level PhpMetrics - Static Analysis PHP-Versions

In this development monorepo you'll find many independent packages that will help you to develop testable, maintainable and PSR-compatible enterprise WordPress projects faster than ever before.

All packages in this repo are specifically designed to be usable in distributed WordPress code and are scopable out of the box.

Table of contents

  1. Repository Overview
    1. Component
    2. Bridge
    3. Middleware
    4. Bundle
    5. Testing
  2. Contributing
  3. Changelog
  4. Security
  5. License
  6. Credits

Repository Overview

You can find all packages in the src/Snicco directory.

Here is a brief overview of the repository: (hint: click the links to go to the dedicated documentation for each package)

Component

This directory contains completely decoupled PHP components that you can use in any WordPress (or any other PHP project) .

  • BetterWPAPI: A better way to interacts with WordPress core functions in distributed WordPress packages.
  • BetterWPCache: A PSR6/PSR16 implementation using the WP_Object_Cache. Supports cache tagging.
  • BetterWPCLI: The missing parts to the already awesome WP-CLI.
  • BetterWPHooks: The WordPress hook system redesign in 2022. (PSR-14 compliant)
  • BetterWPMail: The long overdue upgrade to the wp_mail function.
  • BetterWPDB: Keeps you safe and sane when working with custom tables in WordPress.
  • EventDispatcher: A general purpose, PSR-14 compliant event-dispatcher that powers snicco/better-wp-hooks.
  • HttpRouting: A blazing fast routing system and PSR7/PSR15 middleware dispatcher based on fast-route. Especially build for usage in legacy software where you don't have 100% control over the request-lifecycle.
  • Kernel: A minimal and customizable application bootstrapper.
  • Psr7ErrorHandler: A powerful, PSR-7/PSR-3 compliant error-handler.
  • Session: A custom session implementation for applications where $_SESSION can't be used for various reasons.
  • SignedURL: A standalone package to generate and validate protected urls.
  • StrArr: A zero-dependency,type-safe and psalm-compatible implementation of the illuminate/support string and array helpers.
  • Templating: A unified, immutable API for using and combining different template engines.
  • TestableClock: Helper classes for testing time-dependent code.

Bridge

This directory contains different implementations for interfaces defined in one of the components.

Middleware

This directory contains PSR15-Middleware that can be plugged into the snicco/http-routing component.

  • DefaultHeaders: Add custom headers to all outgoing responses.
  • HttpsOnly: Redirects HTTP => HTTPS for all requests
  • MethodOverride: Allows treating form submissions as PUT|PATCH|DELETE requests.
  • Negotiation: Performs content and language negotiation
  • NoRobots: Disallows search-engines to index the current request path.
  • Payload: Transforms JSON (and other) data to plain PHP arrays.
  • Redirect: Redirects requests to configured locations.
  • ShareCookies: Transforms cookie objects into response headers.
  • TrailingSlash: Redirects /foo/ to /foo or vice-versa.
  • WPAuthOnly: Grants access only to authenticated WordPress users.
  • WPCapability: Grants access only to WordPress users with the configured capability.
  • WPGuestsOnly: Grants access only to guest WordPress users.
  • WPNonce: Will solve all your WordPress Nonces problems once and for all.

Bundle

A bundle is a plugin for the snicco/kernel component and integrates one or more components or bridges to provide out of the box functionality.

While all components can absolutely be used without using the snicco/kernel component, bundles makes usage and configuration effortless.

Testing

This directory contains testing utilities for components. These packages are only meant to be used as development dependencies.

Contributing

We've set up a separate document for our contribution guidelines.

Changelog

Our changelog is automatically generated using the wonderful npm package semantic-release.

Security

Please review our security policy on how to securely report vulnerabilities.

License

This project is licensed under the terms of the GNU LGPLv3 unless otherwise specified in the respective LICENSE.md file of each package. See LICENSE.md

Credits

We want to express our special gratitude to: