szepeviktor/sentencepress

OOP toolkit for daily tasks in WordPress development.

Maintainers

👁 szepeviktor

Package info

github.com/szepeviktor/SentencePress

pkg:composer/szepeviktor/sentencepress

Statistics

Installs: 1 432

Dependents: 0

Suggesters: 0

Stars: 11

Open Issues: 1

v0.4.0 2025-01-06 13:01 UTC

Requires

  • php: ^7.4 || ^8.0

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 56fa7cba8509370b6ffb3ba630f407c5192e29f5

wordpressOOPtools

This package is auto-updated.

Last update: 2026-05-30 13:36:46 UTC


README

👁 Build Status
👁 Packagist
👁 PHPStan

These tools are recommended for use in agency-type projects where you have full control over the development and installation environment.

Installation

composer require szepeviktor/sentencepress

See WordPress website lifecycle for working with WordPress.

Examples

// Instead of wp_enqueue_script('main-js', get_template_directory_uri() . '/assets/js/main.js', [], '8.44', true)
$mainJs = new Script(get_template_directory_uri() . '/assets/js/main.js');
$mainJs
 ->setHandle('main-js')
 ->setVer('8.44')
 ->moveToFooter()
 ->enqueue();
// Instead of add_action('plugins_loaded', [$this, 'init'], 0, 20);
class Plugin
{
 use SzepeViktor\SentencePress\HookAnnotation;
 public function __construct()
 {
 $this->hookMethods();
 }

 /**
 * @hook plugins_loaded 20
 */
 public function init(): void
 {
 doSomething();
 }
}
// Instead of require __DIR__ . '/inc/template-functions.php';
// template-functions.php will be loaded and pingbackHeader called when wp_head hook is fired
class Template
{
 use SzepeViktor\SentencePress\HookProxy;
 public function __construct()
 {
 $this->lazyHookFunction(
 'wp_head',
 __NAMESPACE__ . '\\TemplateFunction\\pingbackHeader',
 10,
 0,
 __DIR__ . '/inc/template-functions.php'
 );
 }
}