PHPackages                             mnb/mnb-secure-core - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. mnb/mnb-secure-core

ActiveLibrary[Security](/categories/security)

mnb/mnb-secure-core
===================

mnb-secure-core reusable no-framework PHP security core for custom applications.

v1.0.1(3w ago)03MITPHPPHP &gt;=8.1CI failing

Since Jun 30Pushed 3w agoCompare

[ Source](https://github.com/mnagendrababu23/mnb-secure-core)[ Packagist](https://packagist.org/packages/mnb/mnb-secure-core)[ RSS](/packages/mnb-mnb-secure-core/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (3)Used By (0)

MNB Secure Core
===============

[](#mnb-secure-core)

**Package:** `mnb/mnb-secure-core`
**Version:** `v1.0.1`
**Type:** reusable no-framework PHP security library
**PHP:** 8.1+
**License:** MIT
**Author:** Nagendra babu Macharla ([www.linkedin.com/in/nagendra-babu-macharla-55b703152](http://www.linkedin.com/in/nagendra-babu-macharla-55b703152))

MNB Secure Core is a reusable PHP security foundation for custom applications that do not depend on a framework. It is designed for admin panels, APIs, school/ERP systems, CRM tools, billing platforms, file tools, reporting dashboards, and other PHP applications that need production-grade security building blocks without adopting Laravel/Symfony/Slim as a hard dependency.

The current `v1.0.1` release line includes request security, authentication, authorization, data protection, file safety, database governance, runtime command safety, outbound network/SSRF protection, security verification, safe errors, memory safety, throughput/capacity governance, origin protection, async queues, token/session control, XSS enforcement, and final production readiness tooling.

---

Why use MNB Secure Core
-----------------------

[](#why-use-mnb-secure-core)

MNB Secure Core helps PHP teams add serious application security without rebuilding the same controls again and again for every project. The library is especially useful for no-framework apps, shared-hosting projects, custom admin panels, API backends, ERP/CRM systems, education platforms, file tools, and internal business applications.

Key advantages:

AdvantageBenefitNo-framework designWorks with plain PHP projects and can also be integrated into existing frameworks.Central security kernelGives one consistent entry point for request, auth, database, files, logs, queues, sessions, and production checks.Security-by-policy approachHigh-risk actions such as SQL, schema changes, command execution, outbound HTTP, queues, and sessions are controlled by explicit policies.Faster secure developmentReduces the need to manually build CSRF, rate limits, data masking, upload validation, audit logs, safe errors, token revocation, and production checks.Safer production defaultsEncourages deny-by-default behavior, allow-lists, secret redaction, private storage, safe headers, and release-gate checks.Tenant and role awarenessHelps protect multi-tenant systems by connecting trust zones, authorization, database policies, cache keys, files, sessions, and audit events.Full lifecycle protectionCovers incoming requests, business operations, background jobs, outbound integrations, runtime execution, monitoring, verification, and release readiness.Built-in diagnosticsProvides CLI checks, demos, vulnerability reports, readiness checks, coverage reports, and release build planning.Safer logs and evidenceKeeps frontend responses clean while preserving redacted technical logs, audit records, pentest evidence, and incident response context.Composer installationInstalls cleanly from Packagist with `composer require mnb/mnb-secure-core`.> For more detailed feature documentation and code examples, refer to the `docs/` directory. For runnable usage samples, refer to the `examples/` and `demos/` directories.

---

Current release status
----------------------

[](#current-release-status)

Latest local validation from the current `v1.0.1` upgrade line:

CheckResultPHP lintPassedTest suite398 passed, 0 failedDemo suitePassedConfig validationPassedVulnerability score99.05Vulnerability gradeA+> Production `doctor`/readiness results still depend on your real `.env`, secrets, HTTPS, CDN/proxy, storage paths, database user, and deployment firewall settings.

---

What this package protects
--------------------------

[](#what-this-package-protects)

MNB Secure Core is organized as security engines. Each engine can be used independently, or through `Mnb\SecurityCore\Core\SecurityKernel`.

AreaMain protectionTrust zonesRequest, tenant, user, role, data-class, and resource boundary checksRequest receivingTrusted hosts/proxies, HTTPS, request size, method/content checks, JSON parsing, suspicious request detectionAuthenticationBearer/API/session/webhook/internal authentication strategiesAuthorizationPermissions, scopes, roles, ownership, tenant isolation, field-level filteringData protectionEncryption, masking, search hashes, redaction, export protectionWeb securityEscaping, HTML sanitization, CSP/security headers, safe redirects, signed URLs, secure cookiesAPI/rate limitingToken scopes, rate policies, abuse throttlingFile securityUpload validation, private storage, malware scanner hooks, protected downloads, retention cleanupCache strategyTenant-aware keys, TTLs, encryption for sensitive cache policies, invalidation, stampede guardSecrets`.env` loading, secret inventory, redaction, scanning, rotation reportsLogging/audit/monitoringJSONL logs, tamper-evident audit, metrics, alerts, retentionBackup/recovery/incidentEncrypted/signed backups, restore dry-runs, playbooks, evidence collectionVulnerability matrixOWASP/CWE-style vulnerability coverage mapping, gaps, recommendationsDatabase governancePolicy-based CRUD/search/alter, tenant scoping, query limits, schema plans, result maskingRuntime/networkSafe process runner, command allow-listing, outbound HTTP guard, SSRF/DNS/redirect protectionsVerification/remediationPentest checklist, evidence bundles, SLA plans, retest gates, release gatesSafe errorsSafe public responses, hidden technical logs, problem+JSON, log redaction, error fingerprintingMemory/resource safetyOperation memory profiles, stream guards, bounded buffers, temp file budgets, worker leak checksThroughput/capacityLatency budgets, concurrency limiting, adaptive throttling, queue pressure, SLO and capacity gatesOrigin protectionDirect IP Host blocking, trusted proxy validation, fingerprint stripping, leak scanning, firewall guidanceQueue/background jobsAsync dispatch, 202 responses, idempotency, retries, dead-letter queue, worker supervisionToken/session controlToken revocation, refresh rotation, session registry, forced logout, remember-me safetyFinal readiness/XSSSafe template rendering, unsafe output scan, production checklist, release build planning---

Requirements
------------

[](#requirements)

Required:

- PHP 8.1 or higher
- `openssl`
- `fileinfo`
- `json`
- `pdo`
- Writable private storage outside the public web root

Recommended/optional:

- `zip` for ZIP backup/archive workflows
- `redis` for distributed cache, rate limiting, tokens, and queues
- ClamAV for production malware scanning
- HTTPS in production
- CDN/reverse proxy + firewall when origin IP hiding is required

Check your PHP environment:

```
php -v
php -m | grep -E "openssl|fileinfo|json|pdo|zip|redis"
```

---

Installation
------------

[](#installation)

### Option A: direct library placement

[](#option-a-direct-library-placement)

Recommended for no-framework apps and shared hosting:

```
my-php-app/
├── public/
│   └── index.php
├── app/
├── config/
│   └── security.php
├── storage/
│   ├── private/
│   ├── quarantine/
│   ├── cache/
│   ├── logs/
│   ├── audit/
│   ├── backups/
│   ├── queue/
│   └── tokens/
└── libraries/
    └── mnb-secure-core/

```

Bootstrap:

```
