Update PHP version & shrink codebase to reduce attack surface — make this a lightweight cURL client to improve DX
Summary
We should update the project to a modern, actively-supported PHP version and intentionally reduce the number of files and surface area in the repository. The project's mission should be clarified and enforced: act as a lightweight, minimal client for curl focused on improving developer experience for integrators. This will reduce maintenance burden, lower security risk, and make the library easier to understand and integrate.
Why
- Security: Older PHP versions are often unsupported and miss security fixes. A smaller codebase reduces the number of files an attacker can probe or exploit.
- Maintainability: Fewer files and clearer responsibilities make code easier to review, test, and refactor.
- Developer Experience (DX): A tiny, well-documented client makes it faster for developers to integrate and reduces friction (and cognitive load).
- Performance & footprint: Less code → fewer dependencies → faster install and smaller distribution size.
Proposal
-
Bump PHP requirement to a supported LTS (e.g.
>=8.1, recommend8.2+) and update CI to run tests against the chosen versions. -
Prune the codebase by:
- Removing duplicated, dead, or rarely-used files.
- Collapsing small files/classes into a compact, well-namespaced minimal API where it makes sense.
- Replacing heavy abstractions with a single small client around curl that offers the integration points we need (auth, retries, timeouts, hooks).
-
Define and document the mission in README and contributor docs: “This repo is a lightweight cURL-based HTTP client aimed at simplifying integration for application developers.”
-
Add security-focused checks to CI (static analysis, dependency audit) and minimize third-party dependencies.
-
Provide migration docs & deprecation policy for any removed or changed public APIs.
Acceptance criteria
-
composer.jsonrequires PHP>=8.1(or agreed target) and tests run on that version in CI. -
The repository file count is reduced (target: remove X% of non-essential files) — see PR checklist for specifics.
-
There is a single clearly-documented client class (or tiny set of classes) that wraps curl with:
- simple request API (GET/POST/PUT/DELETE + options)
- a small middleware/hook mechanism for auth/retries/logging
- configurable timeouts and error handling
-
README updated to state the project mission and show quickstart usage in ≤5 lines.
-
Security scan/CI step added that fails the build on known high-severity vulnerabilities in dependencies.
-
Backwards-incompatible changes documented with a migration guide.
Implementation checklist (suggested)
- [ ] Decide target PHP version (recommend
8.2) and updatecomposer.json. - [ ] Update CI matrix and test suite to run on target PHP versions.
- [ ] Inventory all files and label them:
public-api,internal,vendor-like,docs,deprecated. - [ ] Remove or archive deprecated/unused folders (move to
archive/if needed). - [ ] Refactor to consolidate small helpers into a minimal client module.
- [ ] Replace heavy serializers/parsers with built-in or single-file helpers where possible.
- [ ] Add security audit step (e.g.,
composer auditor equivalent) to CI. - [ ] Write migration guide and update README with mission + quickstart.
- [ ] Run full test suite, fix regressions.
- [ ] Announce breaking changes in release notes and tag a major version if needed.
Risks & mitigations
- Breaking changes for downstream users — Mitigate with a clear migration guide, deprecation warnings and a short compatibility layer for the most-used APIs.
- Lost functionality — Before removing anything, check usage telemetry (or search the codebase and open-source ecosystem) and consider archiving code instead of deleting if unsure.
- CI/hosting constraints — Validate that our CI/hosting supports the target PHP version before enforcing it.
Notes / Discussion points
- If we require
>=8.2, we can use new language features (readonly properties, enums, improved performance). If we prefer wider compatibility,>=8.1is acceptable. - Define a target file-count or size reduction goal (e.g., remove all legacy adapters not used in the last 12 months).
- Decide whether to maintain a separate “compat” branch for older consumers.
If you like, I can draft the actual PR template and a migration guide for the top 3 breaking changes we expect (public API renames, removed helpers, runtime requirement). Which PHP minimum would you prefer me to target in the issue (8.1 or 8.2)?