{"id":18057776,"url":"https://github.com/connellr023/gratis","last_synced_at":"2025-04-05T10:42:21.363Z","repository":{"id":216392386,"uuid":"738807754","full_name":"connellr023/gratis","owner":"connellr023","description":"A lightweight framework for developing REST-like APIs in PHP.","archived":false,"fork":false,"pushed_at":"2024-01-13T18:29:49.000Z","size":133,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-10T21:36:55.890Z","etag":null,"topics":["framework","mvc","object-oriented","php8"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/connellr023.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-04T05:04:25.000Z","updated_at":"2024-01-23T03:44:07.000Z","dependencies_parsed_at":"2024-01-13T20:41:54.631Z","dependency_job_id":"a6065669-8e73-4ad9-b223-731c2ad9445f","html_url":"https://github.com/connellr023/gratis","commit_stats":null,"previous_names":["connellr023/gratis"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/connellr023%2Fgratis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/connellr023%2Fgratis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/connellr023%2Fgratis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/connellr023%2Fgratis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/connellr023","download_url":"https://codeload.github.com/connellr023/gratis/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247325646,"owners_count":20920713,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["framework","mvc","object-oriented","php8"],"created_at":"2024-10-31T02:22:58.675Z","updated_at":"2025-04-05T10:42:21.343Z","avatar_url":"https://github.com/connellr023.png","language":"PHP","readme":"\u003ch1\u003e\n \u003cimg src=\"https://github.com/connellr023/gratis/blob/main/public/images/logo_large.png?raw=true\" width=\"450px\" /\u003e\n\u003c/h1\u003e\n\n\u003e A lightweight framework for developing *REST-like* APIs in **PHP**.\n\n\u003cdiv align=\"left\"\u003e\n \u003cimg src=\"https://img.shields.io/badge/developer-Connell Reffo-de2349\"\u003e\n \u003cimg src=\"https://img.shields.io/badge/license-MIT-3643d1\"\u003e\n \u003cimg src=\"https://img.shields.io/badge/language-PHP-937dbd\"\u003e\n \u003cimg src=\"https://github.com/connellr023/gratis/actions/workflows/unit.yml/badge.svg\"\u003e\n\u003cimg src=\"https://github.com/connellr023/gratis/actions/workflows/integration.yml/badge.svg\"\u003e\n\u003c/div\u003e\n\n\u003cbr /\u003e\n\n### Table Of Contents\n- [Overview](#overview)\n- [Composer](#composer)\n- [Intended Structure](#intended-structure)\n    - [Middlewares](#middlewares)\n    - [Controllers](#controllers)\n    - [Models](#models)\n    - [View](#view)\n- [Documentation](public/doc/INDEX.md)\n  - Structure\n    - [Middlewares](public/doc/MIDDLEWARES.md)\n    - [Controllers](public/doc/CONTROLLERS.md)\n    - [Models](public/doc/MODELS.md)\n    - [View](public/doc/VIEW.md)\n  - Services\n      - [Router Class](public/doc/ROUTER.md)\n      - [Database Class](public/doc/DATABASE.md)\n- [Development](#development)\n    - [Requirements](#requirements)\n    - [Installing Dependencies](#installing-dependencies)\n    - [Continuous Integration](#running-the-phpunit-test-suite)\n- [License](#license)\n\n\u003cbr /\u003e\n\n### Overview\n**Gratis** is a versatile framework designed to promote the separation of concerns,\nfostering scalable code practices by encapsulating logic within handlers.\nPrimarily tailored for creating robust and scalable APIs that follow the **CRUD** lifecycle, the framework follows a *REST-like* architectural style.\nIt allows form seamless interactions with **SQL** databases, providing a structured and efficient foundation for building web applications.\n\n\u003cbr /\u003e\n\n### Composer\nThe **Gratis** framework can be used in a composer **PHP** project by running the following command,\n```bash\ncomposer require connell/gratis\n```\n\n\u003cbr /\u003e\n\n### Intended Structure\n```text\n│\n└── src/\n    ├── Models/\n    │ └── ...\n    │\n    ├── Controllers/\n    │ └── ...\n    │\n    ├── Middlewares/\n    │ └── ...\n    │\n    ├── View/\n    │ └── ...\n    │\n    └── ...\n```\nThe code structure is meticulously crafted to adhere to a well-defined separation of concerns, delineating distinct roles for *model*, *controller*, *middleware*, and *view* components.\n\n- ### Middlewares\n  Positioned at the forefront of the process, middlewares gain initial access to client *request* and *response* objects before the controller takes charge. This makes them adept at tasks like client verification and handling cross-origin resource sharing.\n\n- ### Controllers\n  Tasked with managing HTTP requests, controllers within the API play a pivotal role in orchestrating communication with the backend logic, ensuring a seamless exchange of information with the front end.\n\n- ### Models\n  Endowed with the capability to execute database I/O operations, models uphold a rigorously typed database schema. This commitment ensures robust data integrity and reliability throughout the system.\n\n- ### View\n  Housed within a dedicated directory, the *View* encapsulates static webpage code tailored for a single-page web application.\n\nThis framework is specifically designed to integrate with static files generated by contemporary front-end frameworks, such as **Vue.js** or **React**.\n\n\n\u003cbr /\u003e\n\n### Development\nBelow details information about the development environment.\n\n\u003cbr /\u003e\n\n### Requirements\nThe required dependencies for this framework are as follows from `composer.json`,\n\n```json\n\"require\": {\n  \"php\": \"^8.3\",\n  \"ext-pdo\": \"*\"\n},\n\"require-dev\": {\n  \"phpunit/phpunit\": \"^10.5\",\n  \"guzzlehttp/guzzle\": \"^7.8\"\n}\n```\n\n\u003cbr /\u003e\n\n### Installing Dependencies\nThe only dependency used in this framework is **PHPUnit** for development testing. In order to install **PHPUnit**\nas well as generate autoload files, run the following command,\n```bash\ncomposer install\n```\n\n\u003cbr /\u003e\n\n### Running The PHPUnit Test Suite\nIf you want to run the integration tests, the local **PHP** development server must\nbe running on `http://localhost:8000`. There is a script to do this in `composer.json`,\n```bash\ncomposer dev\n```\nIn order to the run the entire automated test suite for this framework, execute,\n```bash\ncomposer test\n```\nFor just integration,\n```bash\ncomposer test:integration\n```\nFor just unit tests,\n```bash\ncomposer test:unit\n```\nor see the **GitHub Actions** tab.\n\n\u003cbr /\u003e\n\n### License\nThis software is distributed under the **MIT** license. See `LICENSE` for more information.\n\n\u003cbr /\u003e\n\u003cbr /\u003e\n\n\u003cdiv align=\"center\"\u003e\n \u003cimg src=\"https://github.com/connellr023/gratis/blob/main/public/images/logo_small.png?raw=true\" width=\"150px\" /\u003e\n \u003cbr /\u003e\n \u003cbr /\u003e\n \u003cdiv\u003eDeveloped and tested by \u003cb\u003eConnell Reffo\u003c/b\u003e in 2024.\u003c/div\u003e\n\u003c/div\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconnellr023%2Fgratis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconnellr023%2Fgratis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconnellr023%2Fgratis/lists"}