Features
Features of DataForge
DataForge offers a comprehensive set of features designed to simplify backend development, improve performance, and provide unparalleled flexibility for developers. Here is a detailed breakdown of its standout capabilities.
API Tester
Use the form below to test API endpoints:
1. Unified Architecture
DataForge seamlessly integrates SQL, Entity, and Task classes to provide a unified structure for managing data and workflows.
- Centralized query and logic handling.
- Consistent data manipulation across different modules.
- Simplified integration into existing Laravel projects.
Example:
$invoice = DataForge::getInvoice(12345);
$total = $invoice->TotalAmount;
$items = $invoice->Items;
2. Advanced Query Management
Define and reuse modular SQL queries with the Query class.
Key Features:
- Reusable Queries: Modular design ensures consistent query logic.
- Dynamic Filters: Add runtime filters for flexible data retrieval.
- Aggregations: Simplify summary and reporting queries.
Example:
$query = Query('InvoiceSummary')
->select('summary', 'SUM(amount) AS total, COUNT(id) AS count')
->from('invoices')
->filter('status = {request.status}')
->group('customer_id');
3. Entity-Based Data Handling
Encapsulate business logic within Entity classes for modular and reusable data operations.
Key Features:
- Lazy Loading: Attributes are fetched only when accessed.
- Relationships: Seamlessly connect related entities.
- Strong Typing: Enforce type safety in your code.
Example:
$invoice = DataForge::getInvoice(12345);
$customer = $invoice->Customer;
$payments = $invoice->Payments;
4. Preconfigured API Endpoints
Expose your applicationās functionality with ready-to-use endpoints.
Supported Endpoints:
api/list
: Fetch paginated records.api/all
: Fetch all matching records.api/item
: Fetch a single record.api/field
: Fetch a single value or aggregate.api/entity
: Access entity attributes and relationships.api/Task
: Execute custom workflows.api/GuestTask
: Provide secure guest access.
Example:
/api/list/Invoice/list?pageNo=1&limit=20&status=unpaid
5. Task-Based Workflows
Implement complex workflows with Task and GuestTask classes.
Key Features:
- Custom Logic: Combine SQL, Entity, and external API calls.
- Reusability: Modular methods for shared use cases.
- Error Handling: Graceful error propagation with
$this->setError()
.
Example:
use DataForge\Task;
class InvoiceTask extends Task
{
function generateReport($request)
{
$invoices = Sql('Invoice:list', ['status' => 'unpaid'])->fetchRowList();
$total = array_sum(array_column($invoices, 'amount'));
return [
'Invoices' => $invoices,
'TotalUnpaid' => $total
];
}
}
6. Secure Guest Access
Provide limited data access to unauthenticated users via GuestTask
methods.
Key Features:
- Data Protection: Restrict sensitive information.
- Controlled Exposure: Expose only required data fields.
Example:
/api/GuestTask/System/guestHealthCheck
7. Performance Optimization
Key Features:
- Lazy Loading: Load attributes only when accessed.
- Efficient Queries: Use dynamic filters and aggregations to minimize database load.
- Caching Support: Integrate with Laravelās caching mechanisms.
Example:
$summary = $invoice->toArray('Summary');
// Returns cached data if accessed before.
8. Modular Scalability
DataForge is designed to grow with your application.
Key Features:
- Extensible Classes: Add new methods and features without modifying the core.
- Multi-Database Support: Future-ready for handling multiple databases.
- Attribute Collections: Group related attributes for bulk operations.
Example:
$summary = $invoice->toArray('Summary');
9. Security Features
DataForge prioritizes secure data handling.
Key Features:
- Role-Based Access Control: Restrict data access based on user roles.
- Error Logging: Debug with named queries and structured logs.
- Guest Access Restriction: Clearly separate public and private endpoints.
Conclusion
DataForge brings unparalleled flexibility, scalability, and performance to backend development. Whether building web apps, mobile backends, or service-oriented architectures, its rich feature set ensures developers can deliver high-quality, maintainable solutions efficiently.