Download the PHP package hacon/theme-core without Composer

On this page you can find all versions of the php package hacon/theme-core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package theme-core

Hacon ThemeCore

A set of core features for Hacon WordPress themes.

hacon/theme-core is a PSR-4 Composer library that provides the shared building blocks used across Hacon WordPress themes: a singleton module system, reusable services, a component templating layer, AJAX form handling, and a large set of WordPress/utility helper functions.

Installation

Install into a theme via Composer:

Then load Composer's autoloader from the theme bootstrap (e.g. functions.php):

Autoloading is configured in composer.json:

On load, src/Services. This makes the global helper and shortcut functions available everywhere.

Concepts

Theme Modules

Each feature is a Theme Module — a singleton extending ThemeModuleInterface). Modules are initialized once with an optional config array:

initModule(array $config = []) constructs the singleton (passing $config to the constructor) and calls init(). Calling it again is a no-op. getInstance() returns the live instance. Cloning and unserializing are blocked.

Configuration

ConfigurationService reads config files from the theme's config/ directory using dot notation. It tries config/<name>.php (returning an array) first, then config/<name>.json.

Note: the global shortcut is getThemeСonfig() (see shortcut). Passing null as the key returns the service instance.

Component Templating

Render PHP component templates with HTML attributes and props via ComponentRenderService:

HTML attribute helpers (HtmlAttributesService) are exposed as assembleHtmlAttributes() and arrayToHtmlAttributes().

Available Modules

Module Purpose
ThemeAssetsLoader Register/enqueue CSS & JS per context (frontend, admin, block editor, inline, lazy); strip default WP assets
ACF Advanced Custom Fields integration / setup
Polylang Polylang multilingual helpers and string registration
ReCaptcha reCAPTCHA settings page + verification
Seeders Data seeders, run via ?seeders=name,other URL param
FormOrdersPostType form-orders post type + admin export of form submissions
GutenbergBlocksWhitelist Restrict allowed Gutenberg block types
EnableSVG Allow safe SVG uploads
FaviconInjector Inject favicons into head (frontend, admin, login)
HotReload Dev hot-reload trigger script
InternalNavigationPrefetch Prefetch internal links for faster navigation
PageAutoTableOfContetns Auto table of contents from page headings
PostColorTheme Per-post color theme + body class
ScrollSaver Persist/restore scroll position
PathPatternCache Cache resolved path patterns
AdminMenuGroupsRegister Group admin menu items
BodyWidthCssComputedVariable Expose body width as a CSS variable
DocumentScrollbarWidthCssVariable Expose scrollbar width as a CSS variable
PreventOnLoadCssTransitions Suppress CSS transitions on page load

Services

Service Purpose
ConfigurationService Dot-notation config access from theme config/
ComponentRenderService Render component PHP templates with props & attributes
HtmlAttributesService Build HTML attribute strings from arrays
TelegramService Send messages to Telegram (used by form handler)
CustomArchivePagesService Map custom pages to post-type archives
PathPatternCacheManager Backing cache for PathPatternCache

Form Handling

FormAjaxHandler wires up an AJAX form action with reCAPTCHA, email + BCC delivery, Telegram notification, optional WP post creation, redirect, and custom submit handlers. Defaults (Telegram token/chat id) are pulled from theme config.

Helpers

Global functions auto-loaded from src/Helpers:

Project Layout

Releasing

Tags drive releases. Run the helper to bump and push a tag (GitHub Actions creates the release):

License

MIT © Hacon


All versions of theme-core with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hacon/theme-core contains the following files

Loading the files please wait ...