{"id":22407409,"url":"https://github.com/patrissoljuns/junsphp","last_synced_at":"2025-07-11T10:34:41.981Z","repository":{"id":104077244,"uuid":"190772622","full_name":"PatrissolJuns/junsphp","owner":"PatrissolJuns","description":"JunsPHP is a fast, open-source, minimalist web framework for PHP. It is simply the best choice for simple websites and small apps such as portfolio pages, landing pages, and so on.","archived":false,"fork":false,"pushed_at":"2020-05-02T18:42:09.000Z","size":696,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-27T01:48:32.961Z","etag":null,"topics":["framework-php","mvc-architecture","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PatrissolJuns.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-06-07T16:03:47.000Z","updated_at":"2021-09-04T04:56:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"92f95a0d-d8d6-48a5-a629-9491eb06a0ee","html_url":"https://github.com/PatrissolJuns/junsphp","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/PatrissolJuns/junsphp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrissolJuns%2Fjunsphp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrissolJuns%2Fjunsphp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrissolJuns%2Fjunsphp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrissolJuns%2Fjunsphp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PatrissolJuns","download_url":"https://codeload.github.com/PatrissolJuns/junsphp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrissolJuns%2Fjunsphp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264785864,"owners_count":23663848,"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-php","mvc-architecture","php"],"created_at":"2024-12-05T11:14:08.265Z","updated_at":"2025-07-11T10:34:41.909Z","avatar_url":"https://github.com/PatrissolJuns.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Logo JunsPHP](https://i.postimg.cc/3rb3LZp3/junsphp-logo.png)\n\n# Author\nPatrissolJuns\n\n[https://patrissol-juns.com](https://patrissol-juns.com) | [Github](https://github.com/PatrissolJuns) | [E-Mail](mailto:patrissolkenfack@gmail)\n\n## About JunsPHP\n\nJunsPHP is a fast, open-source, minimalist web Framework for PHP. It is simply the best choice for simple website and small apps such as portfolio page, landing page and so on.\n\nJunsPHP like others web framework implements MVC architecture and brings out the powerful side of it.\n\n\n## Install JunsPHP\n\nIn order to use the framework, just get the zip of the latest version at [Github](https://github.com/PatrissolJuns/junsphp/archive/master.zip)\n\nThen extract it and run with this command:\n\n```php\nphp -S localhost:8080\n```\n\nYou will therefore get the default home page of the framework\n\n## How to use JunsPHP\n\nSince JunsPHP is using MVC architecture, the usage is a little bit similar than other framework such as Laravel, Symfony and so on.\n\nThis framework use concept like routing, Controller, Model, View and later soon Template Engine.\n\n### The Routing\n \nAll about routing is found into `Routes/routes` file. \n\nIf you want to and a `get` request to the controller `ThingController` and the action `index`, just add this code into `Routes/routes`\n\n```php\nRouter::get('/thing/index', 'ThingController@index');\n```\n\nThis will be available at the route `/thing/index`\n\nThis is the same thing for all other method\n\n### The Controller\n\nControllers are found in `Controllers` folder and their goal is to execute different action. \n\nThe syntax is very similar to a normal php file just that it may include Model and other folders.\n\nhere is an example of controller file\n\n```PHP\nrequire(ROOT . 'Models/Thing.php');\n\nclass ThingController extends Controller\n{\n    public function __construct($request)\n    {\n        parent::__construct($request);\n    }\n    \n    function index()\n    {\n        $thing = new Thing();\n\t\t\n\t\t// data to send\n        $data['things'] = $thing-\u003efindAll();\n        \n        return View::render(\"thing/index\", $data);\n    }\n    function create()\n    {\n        return View::render(\"thing/create\");\n    }\n\n    function save()\n    {\n        if ($this-\u003erequest-\u003egetMethod() == 'POST')\n        {\n            $thing= new Thing();\n\t\t\t\n            $thing-\u003etitle = $this-\u003erequest-\u003egetParams()['title'];\n\t\t\t\n            $thing-\u003edescription = $this-\u003erequest-\u003egetParams()['description'];\n\t\t\t\n            if ($thing-\u003esave())\n            {\n                $this-\u003eredirect(\"thing/index\");\n            }\n        }\n    }\n}\n```\n\n**Note:** Here we have defined a constructor in order to be able to access information about request so a controller must have this constructor.\n\n### The View\n\nView in this framework are found in `Views`.\n\nSince we have yet include a template engine, the manipulation of variable is done directly in PHP code.\n\nIf you pass a variable from the controller to a view trough a table like this example up so, that variable will be directly accessible form the views.\n\nStill continuous our example of Thing, here is a way to display a list of things:\n\n```PHP\n\u003ch1\u003eThing\u003c/h1\u003e\n\u003cdiv class=\"row col-md-12 centered\"\u003e\n    \u003ca href='\u003c?php route(\"/thing/create\") ?\u003e'\u003eCreate\u003c/a\u003e\n    \u003cimg src='\u003c?php asset(\"assets/images/home.png\") ?\u003e' alt=\"logo\" /\u003e\n    \u003ctable class=\"table table-striped custab\"\u003e\n        \u003cthead\u003e\n        \u003ctr\u003e\n            \u003cth\u003eID\u003c/th\u003e\n            \u003cth\u003eName\u003c/th\u003e\n            \u003cth\u003eDescription\u003c/th\u003e\n        \u003c/tr\u003e\n        \u003c/thead\u003e\n        \u003c?php\n        foreach ($things as $thing) \n        {\n        ?\u003e\n            \u003ctr\u003e\n            \u003ctd\u003e\u003c?php print_r($thing['id'])?\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003c?php echo $thing['title']?\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003c?php echo $thing['description']?\u003e\u003c/td\u003e\n            \u003c/tr\u003e\n        \u003c?php\n        }\n        ?\u003e\n    \u003c/table\u003e\n\u003c/div\u003e\n```\n\n### Assets files\n\nThe assets files can be found into `public/assets` folder.\n\nHowever, you can set your own structure within `public` folder.\n\n### The Model\n\nAll model is found in the folder `Models`. Each Modal extends the Model class which provide a sample of method such as:\n\n```PHP\n// findModel($ModelName, $id);\n\n// Example:\nfindModel(\"Thing\", $id);\n```\nwhich will retrieve a particular model passed in parameter.\n\nThis is an example of a Model\n\n```PHP\nclass Thing extends Model\n{\n    public $title;\n    public $description;\n    \n    public function find($id){\n        return $this-\u003efindModel(\"Thing\", $id);\n    }\n    public function findAll(){\n        return $this-\u003efindModelAll(\"Thing\");\n    }\n    public function save()\n    {\n        return $this-\u003esaveModel(\"thing\", ['title', 'description'], [$this-\u003etitle, $this-\u003edescription]);\n    }\n}\n```\n\n**Note:** please open this file `Core/Model` to get all the available methods.\n\n\n### DATABASE Connection\n\nAll the configuration about the database is inside `Config/Database` file.\n\nYou just need to change the database credentials in order to match your own.\n\n\n## Contributing\n\nI will be very happy if you can contribute for this framework in order to built a more powerful framework.\n\nDo not hesitate to contact me at my email `patrissolkenfack@gmail.com`.\n\n## License\n\nJunsPHP is a open source project under the [MIT license](https://opensource.org/licenses/MIT).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrissoljuns%2Fjunsphp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatrissoljuns%2Fjunsphp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrissoljuns%2Fjunsphp/lists"}