{"id":25003499,"url":"https://github.com/pabhoz/foxframework","last_synced_at":"2025-04-23T04:48:07.279Z","repository":{"id":76967181,"uuid":"119300018","full_name":"pabhoz/FoxFramework","owner":"pabhoz","description":"Fox Framework is a lightweight MVC PHP  framework, is as easy as powerful and it is the best choice for a short learning curve to develop really nice and strong product","archived":false,"fork":false,"pushed_at":"2018-11-10T14:43:36.000Z","size":11693,"stargazers_count":6,"open_issues_count":1,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-29T22:11:55.844Z","etag":null,"topics":["fox-framework","mvc-framework","pabhoz","php7-framework"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pabhoz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2018-01-28T21:36:25.000Z","updated_at":"2023-09-02T20:07:45.000Z","dependencies_parsed_at":"2023-05-01T11:48:04.982Z","dependency_job_id":null,"html_url":"https://github.com/pabhoz/FoxFramework","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pabhoz%2FFoxFramework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pabhoz%2FFoxFramework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pabhoz%2FFoxFramework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pabhoz%2FFoxFramework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pabhoz","download_url":"https://codeload.github.com/pabhoz/FoxFramework/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250372939,"owners_count":21419722,"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":["fox-framework","mvc-framework","pabhoz","php7-framework"],"created_at":"2025-02-04T22:30:42.214Z","updated_at":"2025-04-23T04:48:07.261Z","avatar_url":"https://github.com/pabhoz.png","language":"HTML","readme":"# Fox Framework\n\n[![Version](https://img.shields.io/badge/version-1.2.2-red.svg)]()\n[![PHP Version](https://img.shields.io/badge/PHP-7.1-red.svg)]()\n[![CLI Version](https://img.shields.io/badge/CLI-OnDevelopment-blue.svg)]()\n[![License](https://img.shields.io/badge/Licence-Apache--2.0-green.svg)]()\n\n## About Fox Framework\n**Fox Framework** is a **lightweight MVC PHP framework**, is as easy as powerful and it is the best choice for a short learning curve to develop really nice and strong products. Fox is designed to attack the most common problems in the project development process, implementing multiple design patterns both in development and architectural. **Fox is not a black box**, it is **easy to use**, **to understand** and **to modify** to fit the needs of your projects.\n\n### Fox Framework features:\n\n- **MVC pattern** to a better maintainibility.\n- An easy to go configuration file to define DB info and security keys.\n- **PDO integration** to support multiple DBE as MySQL, PostgreSQL, MariaDB, etc.\n- **Fox Model**, the easy way **database ORM**.\n- **RESTful** services support added by default at ``/services``\n- An **Admin Panel** with [**AdminLTE**](https://adminlte.io/) integrated to the framework by default at ``/admin``\n- A **sample site** by default with [**Twitter Bootstrap**](http://getbootstrap.com/2.3.2/) and [**JQuery**](https://jquery.com/) at ``/site``.\n- A complete **test suite** integrated by using [**Codeception**](https://codeception.com/)\n- **Clean URL's** based on .htaccess configurations.\n- Easy data **encryptation** by the Hash class.\n- A badass **CLI** to go even faster (Comming soon).\n- A simple structure made with **\u003c3**.\n\n## A really fast overview\n\nSo a fast archetype review would be:\n\n```\nFoxFramework\n\t|-- admin                        |=\u003e| The Apanel is here\n\t|---- controllers                |=\u003e| all the views logics are here \n\t|---- public                     |=\u003e| admin assets here\n\t|---- views                      |=\u003e| all the admin views in folders with the controller name\n\t|---- index.php                  |=\u003e| the magic one file you should leave alone.\n\t|-- bridges                      |=\u003e| Place all your bridges here\n\t|-- bussinesLogic                |=\u003e| All the project logic must be here\n\t|-- database                     |=\u003e| if you want to store SQL files, well, store them here\n\t|-- factories                    |=\u003e| Place all your abstract factories here\n\t|---- ModelFactory.php\n\t|-- Fox                          |=\u003e| All the framework core is here\n\t|---- Core\n\t|---- Utils\n\t|---- Abstractions\n\t|---- FoxController.php\n\t|---- FoxModel.php\n\t|---- FoxServiceController.php\n\t|-- interfaces\n\t|---- IModelFactory.php\n\t|-- libs                         |=\u003e| All your global (to project) libs must be here\n\t|-- models                       |=\u003e| All your models here\n\t|-- public                       |=\u003e| All your global (to project) assets be here\n\t|-- Services                     |=\u003e| The REST services area\n\t|---- controllers                |=\u003e| all the services logics are here \n\t|---- public                     |=\u003e| services assets here\n\t|---- index.php                  |=\u003e| the magic one file you should leave alone.\n\t|---- WSD                        |=\u003e| Services descriptors here\n\t|-- site                         |=\u003e| The website demo\n\t|---- controllers                |=\u003e| all the views logics are here \n\t|---- public                     |=\u003e| site assets here\n\t|---- views                      |=\u003e| all the site views in folders with the controller name\n\t|---- index.php                  |=\u003e| the magic one file you should leave alone.\n\t|-- tests                        |=\u003e| The tests with codeception!\n\t|-- codeception.yml\n\t|-- config.php                   |=\u003e| Database, encryption and gloabals are here\n\t|-- loader.php                   |=\u003e| Autoload is managed here\n\t|-- mvcBootstrap.php             |=\u003e| MVC magic starts here\n\t|-- restBootstrap.php            |=\u003e| REST magic starts here\n```\n\n## FoxModel a swift ORM\nNow FoxModel has been redisegned to be even more semantic featuring:\n\n### Relation types\nOur ORM currently supports 4 relations types:\n\n#### One to One\nThis is the very basic relation you can define. For example, the `KonohaVillage` model have a current one `Hokage`; this can be define as this:\n\n```php\n\t$konohaVillage-\u003ehasOne(\"CurrentHokage\",$hokage);\n```\nwhere `CurrentHogage` is a relation rule defined at `KonohaVillage` class like this:\n\n```php\nclass KonohaVillage extends \\Fox\\FoxModel {\n\n    private $hasOne = array(\n      'CurrentHokage'=\u003earray(\n          'class'=\u003e'Hokage',\n          'join_as'=\u003e'id',\n          'join_with'=\u003e'village_id'\n          )\n      );\n      \n     public function getHasOne(){\n     \treturn $this-\u003ehasOne;\n     }\n\n}\n```\nonce you call for the relation to be done, don't forget to create your brand new object with its **one to one** relation: `$konohaVillage-\u003ecreate();`.\n\nRemember, the One to One A.K.A hasOne **relation rule template** is this:\n\n```php\nprivate $hasOne = array(\n\t'RuleName'=\u003earray(\n\t\t'class'=\u003e'[Obj class expected]',\n       'join_as'=\u003e'[my primary key attr name]',\n       'join_with'=\u003e'[foreign key name in the other table]'\n    )\n);\n```\n\n#### Inverse One to One\nSo, if you want to define the inverse relation on the `Hokage` model, you can use `belongsTo` method:\n\n```php\n\t$hokage-\u003ebelongsTo(\"HokaguePositionAt\",$konohaVillage);\n```\nwhere `HokaguePositionAt` is a relation rule defined at `Hokage` class like this:\n\n```php\nclass Hokage extends \\Fox\\FoxModel {\n\n    private $belongsTo = array(\n        \n            'HokaguePositionAt' =\u003e array(\n                'class' =\u003e 'KonohaVillage',\n                'join_as' =\u003e 'id',\n                'join_with' =\u003e 'village_id'\n            )\n        \n     );\n      \n     public function getBelongsTo(){\n     \treturn $this-\u003ebelongsTo;\n     }\n\n}\n```\nonce you call for the relation to be done, don't forget to create your brand new object with its **one to one** relation: `$konohaVillage-\u003ecreate();`.\n\nRemember, the Belongs to A.K.A belongsTo **relation rule template** is this:\n\n```php\nprivate $belongsTo = array(\n   'Country' =\u003e array(\n   \t\t'class' =\u003e '[Obj class expected]',\n       'join_as' =\u003e '[primary key name of the foreign key]',\n       'join_with' =\u003e '[foreign key name in my table]'\n\t)\n);\n```\n\n#### One to Many\nLet's define a one to many relation between a `State` model and `City` model:\n\n```php\n\t$state-\u003ehasMany(\"Cities\",$city);\n```\nwhere \"Cities\" is a relation rule defined at `State` class like this:\n\n```php\nclass State extends \\Fox\\FoxModel {\n\n    private $hasMany = array(\n      'Cities'=\u003earray(\n          'class'=\u003e'City',\n          'join_as'=\u003e'id',\n          'join_with'=\u003e'state_id'\n          )\n        );\n      \n     public function getHasMany(){\n     \treturn $this-\u003ehasMany;\n     }\n\n}\n```\nonce you call for the relation to be done, don't forget to create your brand new object with its **one to one** relation: `$state-\u003ecreate();`.\n\nRemember, the One to Many A.K.A hasMany **relation rule template** is this:\n\n```php\nprivate $belongsTo = array(\n\n\t'RuleName' =\u003e array(\n   \t\t'class' =\u003e '[Obj class expected]',\n       'join_as' =\u003e '[primary key name of the foreign key]',\n       'join_with' =\u003e '[foreign key name in my table]'\n\t)\n);\n```\n#### Many to Many\nLet's define a many to many relation between a `User` model and `Rol` model:\n\n```php\n\t$user-\u003ebelongsToMany(\"UserRols\",$rol);\n```\nwhere \"UserRols\" is a relation rule defined at `User` class like this:\n\n```php\nclass State extends \\Fox\\FoxModel {\n\n    private $belongsToMany = array(\n        'UserRols'=\u003earray(\n            'class'=\u003e'Rol',\n            'my_key'=\u003e'id',\n            'other_key'=\u003e'id',\n            'join_as'=\u003e'user_id',\n            'join_with'=\u003e'rol_id',\n            'join_table'=\u003e'user_rols',\n            'data'=\u003e array(\n               '[table attr]'=\u003e'[variable type demo]' // 'aFloat' =\u003e 0.0, 'aString' =\u003e '' \n              )\n            )\n        );\n      \n     public function getBelongsToMany(){\n     \treturn $this-\u003e belongsToMany;\n     }\n\n}\n```\nonce you call for the relation to be done, don't forget to update your object with its **many to many** relation: `$user-\u003eupdate();`.\n\nRemember, the Many to Many A.K.A belongsToMany **relation rule template** is this:\n\n```php\nprivate $belongsToMany = array(\n        'RuleName'=\u003earray(\n            'class'=\u003e'[Obj class expected]',\n            'my_key'=\u003e'[my primary key attr]',\n            'other_key'=\u003e'[the other entity primary key attr]',\n            'join_as'=\u003e'[my attr at n to n table]',\n            'join_with'=\u003e'[the other attr at n to n table]',\n            'join_table'=\u003e'[N to N table name]',\n            'data'=\u003e array(\n               '[table attr]'=\u003e'[variable type demo]' // 'aFloat' =\u003e 0.0, 'aString' =\u003e '' \n              )\n            )\n        );\n```\n\n### Queriying Relations\nNow you can query for your defined relations like this:\n\n```php\n\t$cali = State::getBy(\"name\",\"CALIFORNIA\");\n\t$caliCities = $cali-\u003ehas(\"many\",\"Cities\")); // 1st param could be \"one\" or \"many\", 2nd param is the defined rule name.\n```\nit will return all the California state cities at your database as an object array.\n\n### Populating your objects\nYou can also populate your objects choosing by populate all its defined relations or just one of them like this:\n\n```php\n\t$cali = State::getBy(\"name\",\"CALIFORNIA\");\n\t$cali-\u003epopulate(\"many\",\"Cities\");\n```\nit will set a new attribute to the object called as the rule, in this case it will be called `cities`.\n\n```php\n\t$cali = State::getBy(\"name\",\"CALIFORNIA\");\n\t$cali-\u003epopulateAll();\n```\nit will look for all the relations rules defined and populate all adding attributes to the object called as the rule name.\n\n## Learning Fox Framework\nWe are currently working on our brand new (and super lit) documentation by video tutorials and classic web documentation and tutorials, in fact all our current documentation is writed in spanish so we are translating it to support both English and Spanish langs.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpabhoz%2Ffoxframework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpabhoz%2Ffoxframework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpabhoz%2Ffoxframework/lists"}