openwpsecurity / core
Shared HTTP, database, admin, and security infrastructure for OpenWPSecurity plugins.
Fund package maintenance!
Requires
- php: >=8.2
- laminas/laminas-diactoros: ^3.8
- laminas/laminas-httphandlerrunner: ^2.13
- php-di/php-di: ^7.0
Requires (Dev)
- dealerdirect/phpcodesniffer-composer-installer: ^1.0
- phpunit/phpunit: ^10.5 || ^11.0
- squizlabs/php_codesniffer: ^3.13
- szepeviktor/phpstan-wordpress: ^2.0
- wp-coding-standards/wpcs: ^3.0
README
Composer package: openwpsecurity/core
OpenWPSecurity Core contains shared PHP infrastructure used by OpenWPSecurity WordPress plugins. It does not define WordPress plugin tables, options, admin pages, or activation hooks.
Requirements
- PHP 8.2 or newer
- Composer 2
- WordPress runtime for WordPress adapter classes
Install
composer require openwpsecurity/core:^0.6
API Surface
VictorWitkamp\OpenWPSecurity\Core\Http\IpAddressInspector
Resolves trusted IP headers and normalizes IPv4 and IPv6 candidates.
VictorWitkamp\OpenWPSecurity\Core\Http\WordPressServerRequestFactory
Creates a PSR-7 ServerRequestInterface from the active WordPress request using laminas/laminas-diactoros.
VictorWitkamp\OpenWPSecurity\Core\Http\Response\ResponseDispatcher
Emits HTML, JSON, text, and redirect responses using PSR-7 response factories and laminas/laminas-httphandlerrunner.
VictorWitkamp\OpenWPSecurity\Core\Configuration\SettingsInputSanitizer
Normalizes line-based settings, trusted IP header lists, and IP address lists.
VictorWitkamp\OpenWPSecurity\Core\Location\GeoIpLookup
Classifies local/private IP addresses and resolves country metadata through the PHP GeoIP extension or optional remote lookup.
VictorWitkamp\OpenWPSecurity\Core\View\Reporting\ReportPeriod
Maps supported report periods to labels and durations.
VictorWitkamp\OpenWPSecurity\Core\View\Pagination\AdminPaginator
Builds WordPress admin pagination links for report tables.
VictorWitkamp\OpenWPSecurity\Core\View\Presentation\CountryDistributionPanel
Renders the shared country distribution panel used by OpenWPSecurity report pages.
VictorWitkamp\OpenWPSecurity\Core\Security\Ban\TemporaryBanRepository
Defines the shared active temporary-ban repository contract.
VictorWitkamp\OpenWPSecurity\Core\Security\Ban\AbstractTemporaryBanRepository
Provides indexed table storage, upserts, expiry cleanup, and WordPress object caching for plugin-owned temporary-ban repositories.
VictorWitkamp\OpenWPSecurity\Core\Security\Ban\AbstractTemporaryBanCounterRepository
Provides atomic per-IP temporary-ban recurrence counters for plugin-owned tables.
VictorWitkamp\OpenWPSecurity\Core\Security\Ban\AbstractPermanentBanRepository
Provides indexed table storage, duplicate/private-IP protection, paginated reads, counts, and deletion for plugin-owned permanent-ban repositories.
VictorWitkamp\OpenWPSecurity\Core\Security\Ban\TemporaryBanCleanup
Schedules daily removal of expired temporary-ban rows.
Runtime Dependencies
laminas/laminas-diactoroslaminas/laminas-httphandlerrunnerpsr/http-messagepsr/http-factory
The WordPress adapter classes expect WordPress runtime functions such as get_option() and wp_json_encode() to be available.
Development
Run composer install, then use composer check for WordPress Coding Standards, PHPStan static analysis, and PHPUnit. The repository recommends the VS Code PHP Sniffer & Beautifier and PHPStan extensions, which validate PHP files during development.
Support
OpenWPSecurity Core is maintained as open-source software. Funding helps cover maintenance, testing, documentation, and continued development.
- GitHub Sponsors: https://github.com/sponsors/victorwitkamp
