{"id":23975733,"url":"https://github.com/kodaloid/panini-php","last_synced_at":"2025-02-24T17:15:49.099Z","repository":{"id":133885033,"uuid":"366371701","full_name":"kodaloid/panini-php","owner":"kodaloid","description":"A compact, portable and Composer friendly PHP framework for building web apps.","archived":false,"fork":false,"pushed_at":"2021-10-28T23:44:07.000Z","size":38,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-07T06:52:27.468Z","etag":null,"topics":["composer","framework","php","slim"],"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/kodaloid.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-05-11T12:19:56.000Z","updated_at":"2021-10-28T23:44:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"8f52a937-062c-4cfc-8861-020348af5ab8","html_url":"https://github.com/kodaloid/panini-php","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/kodaloid%2Fpanini-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodaloid%2Fpanini-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodaloid%2Fpanini-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodaloid%2Fpanini-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kodaloid","download_url":"https://codeload.github.com/kodaloid/panini-php/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240521052,"owners_count":19814694,"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":["composer","framework","php","slim"],"created_at":"2025-01-07T06:51:01.803Z","updated_at":"2025-02-24T17:15:49.093Z","avatar_url":"https://github.com/kodaloid.png","language":"PHP","readme":"![Panini PHP Logo](https://kodaloid.com/wp-content/uploads/2018/12/panini-php.png)\n\n# PaniniPHP\nA compact, Composer friendly PHP framework for building web apps.\n\nAdd as much or as little as you want, the point is you start without the kitchen sink!\n\n* Bundles with Symphony/Twig.\n* Stupidly fast, loading only what's needed to get your views rendered.\n* Initial package including vendor files is less than 1mb, less than 400 files.\n* Has an easy to use routing system, with automatic controller and view discovery.\n* Output to Twig, XML, Soap/JSON.\n* Works great alongside popular projects such as React, AngularJS and VueJS.\n\n\n## The Goal\n\nThe goal of Panini PHP is to provide a slim equivalent of modern frameworks like\nCakePHP and Laravel. It handles the essential features you need such as database\nmanagement, user management/permissions, ajax calls, caching, etc... and leaves\nthe rest to you.\n\nThe entire engine can be found under the [system](/system) sub-directory. It's made of a\nhandful of carefully thought out PHP files, and I encourage you to have a look\nthrough them to see how it works.\n\n## Requirements\n\n* PHP 7.1+ Minimum (tested) / 7.4+ Recommended\n* Composer (https://getcomposer.org/)\n* A cup of coffee!\n\n\n## Changelog\n\nAll updates are documented in a changelog file [here](/CHANGELOG.md).\n\n\n## Getting Setup (the one minute install)\n\n1. Download/clone this repo into a folder.\n2. Open a terminal and navigate to your project folder.\n3. Restore the composer vendor files using `composer install`\n4. Launch the site in your browser!\n\n\n## The App Folder\n\nThe app folder holds all files that you'll want to create for your project. It\nlooks like this:\n\n   ```\n   app/controllers/\n   app/models/\n   app/views/\n   app/app.php\n   ```\n\nAlthough Panini is not an MVC framework, it does attempt to adhere to that\nmethodology where possible. So the `controllers` folder hosts PHP files for\nhandling page requests. The `models` folder can be used (but not required) when\nusing ORM technologies like Eloquent. The `views` folder usually mirrors \ncontrollers but with the .twig extension. And `app.php` is a PHP script that\nruns before anything else, giving you the opportunity to set-up things like\ndatabases.\n\n## Routing\n\nPanini automatically routes URLs to the `app/controller/` folder. So for example\nif you run from the root of your localhost, then `http://localhost/pages/about` \nwill route to `app/controller/pages/about.php` and so on.\n\nIf a controller is not found, Panini looks for a `root.php` controller in\ndescending folder order till it finds a controller that exists, or reaches the\ncontrollers folder root. So in the above example, if `about.php` did not exist,\nPanini would search for a controller like this:\n\n   ```\n   app/controllers/pages/about.php\n   app/controllers/pages/root.php\n   app/controllers/root.php\n   ```\n\nPlease note that a valid working controller is required for output when error\nlogs are disabled.\n\n\n## Controllers\n\nA controller file is a PHP script that tells Panini what to do when a URL is\nrequested. The most basic controller file can look like this:\n\n   ```\n   \u003c?php\n\n   $this-\u003epresent_view(null, []);\n   ```\n\nIn the example above, `$this` is the App class instance. And calling the member\nfunction `present_view` asks for a view path \u0026 arguments. Here I've told Panini\nto load a .twig file template with the same name from the `app/views` folder by\njust passing a null, however you can indicate a different one by replacing null\nwith the relative path to another .twig file template.\n\n\n## Modules\n\nOut of the box Panini PHP serves web-pages with the twig engine, but doesn't\nhave any awareness of advanced functionality like databases etc... It's expected\nthat you will want to use Composer to add packages to enhance things.\n\nHowever sometimes you just want things to work. So Panini comes with several\ninstallable *modules* to cover the basics.\n\nHere's an example of how easy it is to set-up and use MySQL using modules (do\nthis in `app.php`):\n\n   ```\n   $db = $this-\u003eload_module(\n      'database',\n      'MySQL_Database',\n      [ DB_HOST, DB_NAME, DB_USER, DB_PASS ]\n   );\n   ```\n\nNotice `$this` represents the app. Once we've loaded the module into the app, we\ncan use it from then on by using `$this-\u003emodules-\u003edatabase` anywhere in our app\nfolder.\n\nTaking the database example further, in a controller, you could then write the\nfollowing to read records from a table on the database:\n\n   ```\n   $data = $this-\u003emodules-\u003edatabase-\u003eselect('SELECT * FROM users');\n\n   $this-\u003epresent_view('users', ['users' =\u003e $data]);\n   ```\n\nThen iterate through them using twig in your `users.twig` view like this:\n\n   ```\n   \u003cul\u003e\n   {% for user in users %}\n      \u003cli\u003e{{ user.name }}\u003c/li\u003e\n   {% endfor %}\n   \u003c/ul\u003e\n   ```\n\n## Views\n\nViews are the front facing code that presents HTML to the user. In general you\nshould have one view per controller, however there are some exceptions to this,\nfor example when you want to include a fragment.\n\nPaniniPHP has full support for the symphony/twig system, including extends as\ndemonstrated in the views folder.\n\n## License\n\nThe project will always be free to use and modify under the MIT license [here](/LICENSE).\n\n## Contributing \u0026amp; Support\n\nThere is a lot of scope to improve this project. Please take advantage of the\nissues and improvement features of this repo to make suggestions. If you would\nlike to become a contributor, please visit my site (http://kodaloid.com/) and\ncontact me using my details there.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkodaloid%2Fpanini-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkodaloid%2Fpanini-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkodaloid%2Fpanini-php/lists"}