Suitable for API applications
This is a service layer for CI.
Because of the development pattern in CI, we can only use Model-View-Controller to build applications. But many of us just use it to develop API server or other server without VIEW, then the question is there will be many businesses logic or services logic in the Controller layer even in the Model layer. It's really hard to reuse code.
By CodeMysophobia , I do need clearly code everytime and everywhere, so, I decided to make another layer to solve this problem.
Model layer: Represents your data structures. Typically your model classes will contain functions that help you retrieve, insert, and update information in your database(the same as CI). At last but not least. Do not include any logic or data-check.
Controller Layer: Operate and format I/O, only call Service Layer to handle data and get the result in the callback.
Service Layer: Build the main logic of one feature, this layer can call other service in the same layer. Focus on one thing. Do not include any businesses logic.
How to Use
- New files
- New directory
- New Service Layer file in the folder in 2
2017.4.17 - Init project.
2017.4.19 - Add Travis CI & PHPUnit
Author: Rick Lu