{"id":20447308,"url":"https://github.com/wilfredpine/confired","last_synced_at":"2025-10-24T08:17:06.315Z","repository":{"id":63649512,"uuid":"338984051","full_name":"wilfredpine/confired","owner":"wilfredpine","description":"A light and basic PHP MVC Framework. It was created to examine the structure of an MVC Framework and how it works. It uses static methods to implement Libraries or Helpers better, clear, and easy management. In some PHP versions, a static method is slower than non-static methods. You can also use object-oriented approach.","archived":false,"fork":false,"pushed_at":"2024-11-13T08:51:38.000Z","size":75,"stargazers_count":9,"open_issues_count":0,"forks_count":9,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T19:01:42.217Z","etag":null,"topics":["framework","model-view-controller","mvc","mvc-architecture","mvc-framework","oop","php"],"latest_commit_sha":null,"homepage":"https://confired.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wilfredpine.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":"2021-02-15T06:13:47.000Z","updated_at":"2024-11-13T08:51:42.000Z","dependencies_parsed_at":"2024-11-13T09:36:17.233Z","dependency_job_id":null,"html_url":"https://github.com/wilfredpine/confired","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilfredpine%2Fconfired","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilfredpine%2Fconfired/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilfredpine%2Fconfired/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilfredpine%2Fconfired/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wilfredpine","download_url":"https://codeload.github.com/wilfredpine/confired/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650775,"owners_count":21139681,"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","model-view-controller","mvc","mvc-architecture","mvc-framework","oop","php"],"created_at":"2024-11-15T10:25:46.787Z","updated_at":"2025-10-24T08:17:01.294Z","avatar_url":"https://github.com/wilfredpine.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [ConfiRed](https://confired.com) (light \u0026 basic PHP MVC Framework)\r\n\r\nA light and basic PHP MVC Framework. It was created to examine the structure of an MVC Framework and how it works. It uses static methods to implement Libraries or Helpers better, clear, and easy management. In some PHP versions, a static method is slower than non-static methods. You can also use object-oriented approach.\r\n\r\nDeveloped by Wilfred V. Pine © 2020\r\n\r\nVersion: 1.4.0\r\n\r\n\r\n## System Configuration\r\n\r\n### suit/dev\r\n\r\n* config.php - configure environment, base_url\r\n\r\n```php\r\ndefine('ENVIRONMENT', 'development');\r\n//define('ENVIRONMENT', 'production');\r\ndefine('BASE_URL', 'https://confired.com/');\r\n//define('BASE_URL', 'http://localhost/confired/');\r\n```\r\n\r\n* db.php - database configuration\r\n\r\n```php\r\ndefine('DBHOST','localhost');\r\ndefine('DBNAME','confired');\r\ndefine('DBUSER','root');\r\ndefine('DBPASS','');\r\ndefine('CHARSET','utf8');\r\ndefine('DBPORT',':3306');\r\n```\r\n\r\n* map.php - set routing configuration\r\n\r\n```php\r\n// Default controller to load\r\ndefine('DEFAULT_CONTROLLER', 'Home');\r\ndefine('DEFAULT_METHOD', 'index');\r\n\r\n// roouting\r\nMap::site(['Login'=\u003e'Access']);\r\nMap::site(['Logging-in'=\u003e'Access/signing_in']);\r\nMap::site(['Category-list/@any'=\u003e'Category/index/$1']);\r\n```\r\n\r\n* startup.php - load services on startup\r\n\r\n```php\r\n// Models\r\ndefine('MODELS', array('access'));\r\n// Helpers\r\ndefine('HELPERS', array('page_url','session'));\r\n// Addons\r\ndefine('ADD_ON', array());\r\n// Libraries\r\ndefine('LIBRARIES', array('protection','form'));\r\n// Function\r\ndefine('FUNCTIONS', array('setting','notification','filename'));\r\n```\r\n\r\n## System Controller\r\n\r\n### contructor\r\n\r\n* if not added to startup\r\n\r\n```php\r\n$this-\u003ecallLibraries(['form']);\r\n$this-\u003ecallLibraries(['session']);\r\n```\r\n* use Object\r\n\r\n```php\r\n$this-\u003eform = new Form;\r\n$this-\u003esession = new Session;\r\n```\r\n\r\n### methods\r\n\r\n-POST\r\n\r\n* use Object\r\n\r\n```php\r\n$this-\u003eform-\u003epost('username');\r\n$this-\u003esession-\u003epush(['username'=\u003e'Juan']);\r\n```\r\n or\r\n\r\n* use Static functions associated with the class\r\n\r\n```php\r\nForm::post('username');\r\nSession::push(['username'=\u003e'Juan']);\r\n```\r\n\r\n* Passing data with model\r\n\r\n```php\r\n$data['users'] = $this-\u003eaccess_model-\u003eusers();\r\n```\r\n\r\n* Clean Data before post if not using Form Library\r\n\r\n```php\r\ncleanData($_POST['username']);\r\n```\r\n\r\n* CSRF\r\n\r\n```php\r\n/* generate */\r\necho CSRFToken();\r\n/* validate */\r\nif(CSRFProtect(cleanData($_POST['token'])))\r\n{\r\n    \r\n}\r\n```\r\n\r\n* View\r\n\r\n```php\r\n$this-\u003epreview('home',$data);\r\n```\r\n\r\n* Header Location / redirect\r\n\r\n```php\r\ntransmit('Access');\r\n```\r\n\r\n## System Model\r\n\r\n### visit: [phpdelusions](https://phpdelusions.net/pdo)\r\n\r\n```php\r\npublic function users($id){\r\n    $sql = \"SELECT * FROM users WHERE id = :id LIMIT 1\";\r\n    $query = $this-\u003edb-\u003eprepare($sql);\r\n    $parameters = array(':id' =\u003e $id);\r\n    $query-\u003eexecute($parameters);\r\n    return ($query-\u003erowcount() ? $query-\u003efetch() : false);\r\n}\r\n```\r\n\r\n## System View\r\n\r\n* Sanitize Data\r\n\r\n```php\r\necho Sanitize($data['column']);\r\n```\r\n\r\n* External CSS / JS\r\n\r\n```php\r\n// require style.css\r\ncallCSS(array('style'));\r\n// require custom.js\r\ncallJS(array('custom'));\r\n```\r\n\r\n* Active page\r\n\r\n```php\r\n// active('Home');\r\n\u003cli class=\"\u003c?php active('Home'); ?\u003e\"\u003e\u003ca href=\"\"\u003eHome\u003c/a\u003e\u003c/li\u003e\r\n```\r\n\r\n* Alerts / Notification\r\n\r\n```php\r\nnotify(); // suit/glob/Notification.php\r\n```\r\n\r\n## Create Global functions\r\n\r\n* suit/glob/filename.php\r\n\r\n```php\r\n// set the functions on startup\r\n// suit/dev/startup.php\r\ndefine('FUNCTIONS', array('setting','notification','filename'));\r\n```\r\n\r\n## Session\r\n\r\n```php\r\nSession::pull('username')\r\nSession::push(['name'=\u003e'data','username'=\u003e$username])\r\n```\r\n\r\n## License\r\n[GNU](https://github.com/wilfredpine/confired/blob/main/LICENSE)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilfredpine%2Fconfired","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilfredpine%2Fconfired","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilfredpine%2Fconfired/lists"}