Download the PHP package wirefront/wplitecore without Composer
On this page you can find all versions of the php package wirefront/wplitecore. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download wirefront/wplitecore
More information about wirefront/wplitecore
Files in wirefront/wplitecore
Package wplitecore
Short Description A lightweight PHP core framework designed for seamless development of headless WordPress websites, leveraging the WP-JSON API for efficient, decoupled front-end and back-end integration.
License MIT
Homepage https://github.com/WireFront/WPLiteCore
Informations about the package wplitecore
WPLiteCore
A modern PHP framework for WordPress REST API interactions with both procedural and object-oriented programming approaches.
📍 Quick Navigation
👤 I want to USE WPLiteCore in my project:
- Installation & Basic Usage ← Start here
- Complete API Reference ← Full documentation
- Migration from Old Code
- 🚀 Cache System Documentation ← Performance optimization
- ⚡ Cache Quick Start Guide ← Get started with caching
👨💻 I want to CONTRIBUTE to WPLiteCore:
- Development Setup ← Start here
- Testing Guide ← Testing documentation
- Configuration System
- Running Tests
- Contributing Guidelines
🚀 Quick Start for End Users
If you're using WPLiteCore in your project, it's very simple:
Installation
Basic Usage
🔓 JWT Authentication is Optional!
- Public content: Use
nullas the secret key - no authentication needed - Protected content: Provide your JWT secret key for authenticated requests
- Mixed usage: You can create multiple instances with different authentication levels
WPLiteCore automatically handles authentication based on whether you provide a secret key or not.
Procedural Functions (Backward Compatibility)
That's it! No configuration files, no setup scripts needed for end users.
🚀 High-Performance Caching System
WPLiteCore includes a powerful, multi-layered caching system that can dramatically improve your application's performance:
⚡ Performance Benefits
- API Responses: 80-99% faster (from 200ms to 2-10ms)
- Route Responses: 95-99.9% faster (from 50ms to <1ms)
- Database Load: Reduced by 70-95%
- Server Resources: 60-90% reduction in CPU usage
🔧 Cache System Components
- Core Cache System - File-based caching foundation
- API Response Caching - WordPress API call optimization
- Route Response Caching - Web route response optimization
📖 Complete Cache Documentation
Essential Cache Topics:
- ⚡ Quick Start Guide - Get started in 5 minutes
- Getting Started with Caching
- Basic Routing vs Cached Routing
- WordPress API Response Caching
- Performance Optimization Guide
- Cache Management & CLI Tools
- Production Best Practices
Quick Cache Example
Cache Management
🔗 Full Cache System Guide → - Complete documentation with examples, configuration, and best practices
🔧 For Library Developers and Contributors
⚠️ IMPORTANT: This section is for developers working ON the WPLiteCore library itself (contributors, maintainers, testers). If you're just USING WPLiteCore in your project, you can skip this entire section.
Development Environment Setup
If you're contributing to WPLiteCore or need to run tests:
1. Clone and Install
2. Development Configuration Setup
This creates a .env file for testing. You'll need to configure it with real API credentials for testing.
3. Manual Configuration (Alternative)
Edit the .env file:
Configuration System Details
Config.php Class
The Config.php class is used internally by library developers for:
- Testing: Loading test API credentials securely from
.env - Development: Managing different testing environments
- CI/CD: Environment-based configuration in build pipelines
Note for End Users: You don't need to use
Config.phpdirectly. Just pass your API details toWPLiteCore::create()as shown in the Quick Start section.
Developer Usage:
End User Usage (Simpler):
Environment Variables (For Library Developers Only)
End Users: You don't need to worry about environment variables. Just pass your API details directly to
WPLiteCore::create().
For Library Testing and Development:
| Variable | Purpose | Required for Tests | Example |
|---|---|---|---|
WPLITE_API_URL |
Test API endpoint | ✅ Yes | https://yoursite.com/wp-json/wp/v2 |
WPLITE_HASH_KEY |
Authentication key | ✅ Yes | your-secret-api-key |
WPLITE_SITE_URL |
Test site URL | ❌ Optional | https://yoursite.com |
WPLITE_TEST_POST_ID |
Post ID for testing | ❌ Optional (default: 32) | 123 |
WPLITE_TEST_MEDIA_ID |
Media ID for testing | ❌ Optional (default: 41) | 456 |
WPLITE_DEBUG |
Enable debug mode | ❌ Optional (default: false) | true |
Why Environment Variables for Development?
- Keeps real API credentials out of code
- Allows different test environments
- Secure CI/CD pipeline configuration
- Multiple developers can use different test sites
What Happens Without Configuration
For End Users Using the Library: Nothing special - just pass your API details directly:
For Library Developers Running Tests:
Tests will fail or be skipped without proper .env configuration:
Default fallbacks in development:
- API URL defaults to
https://api.example.com/v2(safe placeholder) - Test post ID defaults to
32 - Debug mode defaults to
false - Tests skip if real credentials aren't available
Configuration Summary
| User Type | Configuration Method | Purpose | Files Needed |
|---|---|---|---|
| End Users | Direct parameters | Using the library | None - just use the library! |
| Library Developers | .env file |
Testing & development | .env (from .env.example) |
| CI/CD Systems | Environment variables | Automated testing | Environment vars only |
Running Tests
For comprehensive testing documentation, see 📋 Testing Guide
Quick Test Commands
Test Requirements
- ✅ API Credentials: Configure
.envwith real API endpoints - ✅ Test Data: Ensure test post/media IDs exist in your API
- ✅ Network Access: Tests connect to live WordPress APIs
📖 Complete Testing Guide → - Detailed instructions, troubleshooting, and test descriptions
File Structure (Development)
Security for Developers
🔒 Critical Security Notes:
- Never commit
.envfiles - they contain real API credentials - Use
.env.examplefor safe templates only - Real API URLs and keys should only exist in environment variables
- The
.gitignorealready protects.envfiles
Testing Security:
Contributing
When contributing to WPLiteCore:
- Set up development environment using
php setup.php - Configure
.envwith your test API credentials - Run tests to ensure nothing breaks:
vendor/bin/phpunit - Write tests for new features
- Update documentation if adding new functionality
- Never commit real API credentials or
.envfiles
📚 API Reference
Core Classes
WPLiteCore
Main entry point for the library.
PostsClient
Handles WordPress posts operations.
ApiResponse
Handles API response data.
Legacy Functions
wlc_single_post()
Get a single post with all related data.
wlc_featured_image()
Get featured image for a specific attachment ID.
wlc_get_api_data()
Generic API data retrieval function.
🔄 Migration Guide
For detailed migration from procedural to OOP approach, see 📋 Migration Guide.
📖 Documentation & Examples
| Document | Description | For |
|---|---|---|
| docs/USAGE.md | Complete API reference with examples | 👤 End Users |
| docs/COMPLETE_CACHE_SYSTEM.md | Complete cache system guide | 🚀 Performance |
| docs/CACHE_QUICK_START.md | Cache quick start (5 minutes) | ⚡ Quick Setup |
| docs/TESTING.md | Testing guide and test descriptions | 🔧 Contributors |
| docs/MIGRATION_GUIDE.md | Upgrade from procedural to OOP | 🔄 Existing Users |
| examples/simple_usage.php | Simple usage examples | 👤 End Users |
| examples/oop_usage_examples.php | Advanced OOP examples | 👤 End Users |
🤝 Contributing
See the development setup section above. All contributions welcome!
📄 License
MIT License - see LICENSE file for details.