{"id":15773982,"url":"https://github.com/viames/pair_boilerplate","last_synced_at":"2026-03-01T18:02:39.871Z","repository":{"id":37581344,"uuid":"85377878","full_name":"viames/pair_boilerplate","owner":"viames","description":"Skeleton project to run Pair PHP framework in seconds","archived":false,"fork":false,"pushed_at":"2026-02-23T14:42:45.000Z","size":2121,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-02-23T22:45:15.011Z","etag":null,"topics":["composer","crud","mvc","mysql","pair","php","skeleton"],"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/viames.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-03-18T05:23:07.000Z","updated_at":"2026-02-23T14:43:16.000Z","dependencies_parsed_at":"2023-11-29T08:27:54.075Z","dependency_job_id":"93d3dd26-cf48-4ecf-8f1a-616fcd626378","html_url":"https://github.com/viames/pair_boilerplate","commit_stats":{"total_commits":112,"total_committers":1,"mean_commits":112.0,"dds":0.0,"last_synced_commit":"46a07055d39b32be8e99400e3991eee68fdba3f5"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/viames/pair_boilerplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viames%2Fpair_boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viames%2Fpair_boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viames%2Fpair_boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viames%2Fpair_boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/viames","download_url":"https://codeload.github.com/viames/pair_boilerplate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viames%2Fpair_boilerplate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29977966,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T16:35:47.903Z","status":"ssl_error","status_checked_at":"2026-03-01T16:35:44.899Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["composer","crud","mvc","mysql","pair","php","skeleton"],"created_at":"2024-10-04T16:04:19.000Z","updated_at":"2026-03-01T18:02:39.860Z","avatar_url":"https://github.com/viames.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pair boilerplate\na skeleton project to use [Pair PHP Framework](https://github.com/viames/pair) easily\n\n[![Latest Stable Version](https://poser.pugx.org/viames/pair_boilerplate/v/stable)](https://packagist.org/packages/viames/pair_boilerplate)\n[![Total Downloads](https://poser.pugx.org/viames/pair_boilerplate/downloads)](https://packagist.org/packages/viames/pair_boilerplate)\n[![Latest Unstable Version](https://poser.pugx.org/viames/pair_boilerplate/v/unstable)](https://packagist.org/packages/viames/pair_boilerplate)\n[![License](https://poser.pugx.org/viames/pair_boilerplate/license)](https://packagist.org/packages/viames/pair_boilerplate)\n[![composer.lock](https://poser.pugx.org/viames/pair_boilerplate/composerlock)](https://packagist.org/packages/viames/pair_boilerplate)\n\nThis base project allows a fast start to develop small to medium PHP applications like CRM or web-portals.\nWith the addition of a few files more, here provided as sample, and an initial database structure, your web project will be up and running in a breeze.\n\n### Features\nThis basic project manages users authentication, creates new custom ActiveRecord classes and [CRUD](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete) modules starting from a DB table by a magic module named `crafter`, all thru a friendly route logic.\nAlso it acts as REST API server with oAuth2 authentication support.\n\n## System Setup\n\n### Apache Configuration\n\n* Activate Apache's `mod_rewrite` module (e.g. with the command `sudo a2enmod rewrite`) to ensure correct reading of virtual URL paths in web pages;\n\n* Check Apache's `httpd.conf` file for the `AllowOverride` and `Options` directives for the project directory, for example:\n\n```apache\n\u003cDirectory /var/www/html\u003e\n        Options Indexes FollowSymLinks\n        AllowOverride None\n\u003c/Directory\u003e\n```\n\n### PHP Configuration\n\n* Make sure that at least `PHP v8.2` or higher is installed and active on the machine;\n\n* Verify that the following PHP 8 extensions are configured:\n    - `fileinfo`\n    - `json`\n    - `pcre`\n    - `PDO`\n    - `intl`\n    - `pdo_mysql`\n    - `Reflection`\n\n### MySQL Configuration\n\n* Locate the MySQL `my.cnf` file, for example `/etc/mysql/my.cnf`, and set the following directives:\n\n```ini\n[mysql]\ndefault-character-set=utf8mb4\n\n[mysqld]\ncollation-server = utf8mb4_unicode_ci\ninit-connect='SET NAMES utf8mb4'\ncharacter-set-server = utf8mb4\nsql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION\n```\n* Verify that the product database is set to charset `utf8mb4` and collation `utf8mb4_unicode_ci`;\n\n* Verify that the database connection user has read, write, modify and delete privileges on the product database;\n\n* Verify the database time, for example with the command `SELECT NOW();` from the command line;\n\n### Project configuration\n\n* Run `git pull origin main` from the command line in the root of the project to download the latest stable version;\n\n* Run `composer install` from the command line in the root of the project to install the dependencies packages;\n\n* Schedule the execution with a one-minute period of the `/cronjob.php` script by activating Crontab on Linux. For example:\n\n```bash\n* * * * * /var/www/html/cronjob.php\n```\n\n* Manually copy from the existing installation, the files and folders present in the root of the project:\n\n- `.env`\n- `/temp`\n\n* Assign write permissions to the `/temp` folder for the Apache user;\n\n* Verify with self-test that everything is configured correctly:\n- Connect to the system web page using the credentials of an admin user;\n- Run the menu module `Self test`;\n- If the result has all green checkmarks, the test is complete;\n- If at least one red `X` appears, make the indicated corrections.\n\n## Quick start\n\nThe [Installer](https://github.com/viames/pair_boilerplate/wiki/Installer) is used to configure the basic data of your web project. It starts automatically when the URL for the root folder is first launched, creates a custom [configuration](https://github.com/viames/pair/wiki/Configuration-file) file and auto-deletes after checking that everything is OK and that the installation was successful.\n\nAfter the installation is completed, all the fields declared in the installer can subsequently be customized by modifying the `configuration` file except those related to the user created. For the latter, it is sufficient to modify it via the Users module.\n\n### Create a new project\n\nTo start a web project with the Pair framework, this sequence is the suggested one:\n\n#### 1. Install the pair_boilerplate\n\nUse Composer to copy php files to a folder into your web server documents path:\n```shell\ncomposer create-project viames/pair_boilerplate my_project_name\n```\n\n#### 2. Run it by the browser\n\nLaunch the browser to the base address of the pair_boilerplate project to start the [Installer](https://github.com/viames/pair_boilerplate/wiki/Installer).\n```shell\nhttp://localhost/my_project_name\n```\nThe project is ready to accept login and will let you manage users.\n\n#### 3. Expand it according to your needs\n\nCreate additional InnoDB tables for database of your project and set the foreign keys properly, these are useful for getting the most out of [ActiveRecord](https://github.com/viames/pair/wiki/ActiveRecord). Then start the built-in [Crafter module](https://github.com/viames/pair_boilerplate/wiki/Developer), which will allow you to create a complete CRUD and class module for each of your custom tables.\n\n#### 4. Customize the template\n\nYour project deserves a unique aspect, so proceed to customize the existing template or install a new template plugin via the built-in `Template` module.\n\n## Project Development\n\nModules and templates are built as plugins that can be installed and downloaded from the system in the form of a compressed ZIP file.\n\n### Folder Structure\n\nThe project folder structure follows the following tree:\n\n```bash\n/classes\n/migrations\n/modules\n    /module1\n        /assets\n        /classes\n        controller.php\n        model.php\n        view1.php\n        view2.php\n        /layouts\n            /layout1.php\n            /layout2.php\n/public\n    /assets\n    /css\n    /img\n    /js\n    /plugins\n    .htaccess\n    index.php\n/temp\n/templates\n    /template1\n        default.php\n        login.php\n        404.php\n/translations\n    en-GB.ini\n    it-IT.ini\n/vendor\n/widgets\n.gitignore\n.htaccess\ncomposer.json\ncomposer.lock\n.env\ncronjob.php\nREADME.md\nroutes.php\n```\n\n### MVC Pattern\n\nEach module in the `/modules` folder contains the three elements of the MVC pattern: `Controller`, `Model` and `View`.\n\n#### Controller\n\nThe Controller must contain only the routing and HTTP request management logic, so it must be as free as possible from business and presentation logic.\n\nAccess controls must be performed in this layer.\n\nThe file name is located in each module folder and is always called `controller.php`.\n\n#### Model\n\nThe Model must contain all the business logic, so it must be as free as possible from routing and presentation logic.\n\nForms common to multiple pages of the module can be managed in this layer.\n\nThe file name is located in each module folder and is always called `model.php`.\n\n#### View\n\nThe View must contain the presentation logic, so it must be as free as possible from routing and business logic. The layout file in the `layouts` folder must contain the HTML code and the minimum instructions for loops and variable output.\n\nEach module usually contains more than one view, each corresponding to a `View` file. The name of each View file, in CamelCase with the first lowercase, contains the second part of the class name, excluding the prefix with the module name.\n\nAn example:\n\n```php\n// file name viewLogin.php\nclass UserViewLogin extends View {\n// ...\n}\n```\n\n### `crafter` module\n\nFor the simplified development of a basic module with all CRUD functions, the `crafter` module is available. This module scans the database for tables not yet associated with a module and automatically generates the code to manage that table.\n\nFor the module to work effectively and for CRUD data to be well-structured, it is necessary to perfectly type the fields of the object table and connect it to the other tables via foreign key relationships.\n\n### `/classes` folder\n\nThis is a folder located in the base folder of the project and contains all the classes and interfaces common to multiple modules. Classes used only in one module can be placed in the `classes` folder inside a module, for example `/users/classes/MySpecialClass.php`.\n\nThe class name must be in CamelCase and must be the same as the file name.\n\nEach file inside classes contains one and only one class.\n\nThese classes can be inherited from `ActiveRecord` or other classes.\n\nInterface files must have the suffix `Interface`, for example `MyInterface.php` and can contain multiple interfaces each.\n\n### Variables\n\nVariable names must describe their content, for example `$mySpecialClass`, which underlies a `MySpecialClass` object.\nVariables must be declared in CamelCase, for example `$mySpecialClass`.\n\n### Constants\n\nConstants must have a name that begins with a prefix that describes their scope of use, therefore their content, for example `CUSTOMIZED_CONSTANT`.\n\nThe name must be all uppercase, separated by an underscore `_`.\n\nPHP default constants, such as `NULL`, `FALSE` and `TRUE`, must be written in uppercase.\n\n```php\ndefine ('CUSTOMIZED_CONSTANT', TRUE);\n```\n\n### Code formatting\n\nThese indications are optional, but they help to keep the project with a common style, therefore more understandable by everyone.\n\n#### Conditions and loops\n\n```php\n// preferable\nif (is_null($var)) {\n    $var = 0;\n} else {\n    $var = 1;\n}\n\n// only for simple conditions\nif (is_null($var)) $var = 0;\nelse if ($var \u003e 3) $var = 3;\nelse $var = 1;\n\n// simple conditions with ternary operator\n$var = is_null($var) ? 0 : 1;\n\n$result = is_a($mySpecialClass, 'MySpecialClass') ?\n? $var-\u003emyFunction()\n: MySpecialClass::getInstance()-\u003emyFunction();\n```\n\n#### Indentation\n\nAlways and only use the tab with a size of 4 spaces each for cpon files with the .php extension.\n\n#### Inline code\n\nIn inline instructions, avoid PHP abbreviated tags. For consistency with pre-existing code, use `print` instead of `echo`.\n\n```php\n// preferable\n\u003c?php print $var ?\u003e\n\n// avoid\n\u003c? print $var; ?\u003e\n```\n\n#### Comments\n\n```php\n// one-line comment, lowercase\n\n/**\n* Function comment, written as a paragraph of text, with punctuation.\n* Does not include description of parameters and return value\n* since it is already declared in the code.\n*/\n```\n\n## Contributing\n\nIf you would like to contribute to this project, please feel free to submit a pull request.\n\n### License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviames%2Fpair_boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fviames%2Fpair_boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviames%2Fpair_boilerplate/lists"}