{"id":22412965,"url":"https://github.com/jakobjohansson/kiwi","last_synced_at":"2025-12-12T04:36:04.777Z","repository":{"id":52422776,"uuid":"75422681","full_name":"jakobjohansson/kiwi","owner":"jakobjohansson","description":"a minimalistic and lightweight blog framework for php","archived":false,"fork":false,"pushed_at":"2021-04-29T19:04:28.000Z","size":1393,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-11T05:34:52.634Z","etag":null,"topics":["blog","blog-engine","hobby-project","in-development","php"],"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/jakobjohansson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-02T18:58:28.000Z","updated_at":"2017-11-30T18:47:54.000Z","dependencies_parsed_at":"2022-08-17T22:55:55.076Z","dependency_job_id":null,"html_url":"https://github.com/jakobjohansson/kiwi","commit_stats":null,"previous_names":["jakobjohansson/verbalizer"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakobjohansson%2Fkiwi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakobjohansson%2Fkiwi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakobjohansson%2Fkiwi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakobjohansson%2Fkiwi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jakobjohansson","download_url":"https://codeload.github.com/jakobjohansson/kiwi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245774535,"owners_count":20669971,"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":["blog","blog-engine","hobby-project","in-development","php"],"created_at":"2024-12-05T14:11:28.729Z","updated_at":"2025-12-12T04:35:59.728Z","avatar_url":"https://github.com/jakobjohansson.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kiwi [![Packagist](https://img.shields.io/packagist/v/jakobjohansson/kiwi.svg)](https://packagist.org/packages/jakobjohansson/kiwi) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/d91c9b74721a47e4a124bc5da221ac73)](https://www.codacy.com/app/jakobjohansson2/kiwi?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=jakobjohansson/kiwi\u0026utm_campaign=badger) [![StyleCI](https://styleci.io/repos/75422681/shield?branch=master\u0026style=flat)](https://styleci.io/repos/75422681)\n\nkiwi is a minimalistic and lightweight blog framework for php.\n\n## Documentation\nKiwi can be installed via Composer:\n```\ncomposer create-project jakobjohansson/kiwi\n```\n\n### Configuration\nIncluded in the package is a `.env.example` file, which should be renamed to `.env` and omitted from version control. It is a simple environment file containing fields for database settings, user settings and more general application settings. Kiwi will not run without this file.\n\nAfter this is done, you should head to the */migrate* route to migrate the default SQL tables.\n\n### Routes\nCustom routes can be set in the `app/routes.php` file, pointing a route towards a controller and a target method:\n```php\n\u003c?php\n/*\n * Routes file.\n * You can create your own custom routes in here, at the end of this file.\n */\n\n $router-\u003eget('', 'PageController/index');\n $router-\u003eget('post/{id}', 'PageController/show');\n```\n\n### Controllers\nAll controllers reside in the `app/Controllers` directory. An example controller is included with the following methods:\n```php\n\u003c?php\n/**\n * Render the main page.\n *\n * @return void\n */\npublic function index()\n{\n    View::render('index', ['posts' =\u003e Post::all()]);\n}\n\n/**\n * Render a specific post page.\n *\n * @param Post $post\n *\n * @return void\n */\npublic function show(Post $post)\n{\n    if (!$post) {\n        throw new HttpException(\"That post doesn't exist.\");\n    }\n\n    View::render('post', ['post' =\u003e $post]);\n}\n```\nNotice the type hinted *Post* parameter in the show method. It will be automatically injected when you provide a wildcard in your route!\n\n#### Middleware\nYou can apply custom middleware by creating a `middleware()` method in your controller. It will run on every request directed towards the controller.\n\n### Views\nAs seen in the example above, views can be requested from a controller method by stating `View::render($viewpath, $arrayOfData)`. The view path is relative to the `app/Views` folder, with a suffixed `.view.php` added at the end, meaning you can simply enter the file name.\n\n### Templating\nKiwi supports templating similar to that of Laravel Blade:\n```php\n\u003cdiv class=\"content\"\u003e\n    @foreach ($posts as $post)\n        \u003ch3 class=\"subtitle is-4\"\u003e\n            \u003ca href=\"/post/{{$post-\u003eid}}\"\u003e\n                {{$post-\u003etitle}}\n            \u003c/a\u003e\n        \u003c/h3\u003e\n        \u003cdiv class=\"content\"\u003e\n            {{nl2br($post-\u003ebody)}}\n        \u003c/div\u003e\n        \u003cfooter\u003e\n            \u003csmall\u003eWritten {{$post-\u003ecreated_at}}.\u003c/small\u003e\n        \u003c/footer\u003e\n    @endforeach\n\u003c/div\u003e\n```\nAt the time of writing, the following directives are supported:\n- if / elseif / else statements\n- echo expressions\n- foreach loops\n- includes\n\n### Validation\nValidation is rather simple with kiwi. Simply access a form field using the `Input` class, which takes the field name as the first parameter and an array of rules as the second parameter:\n```php\n\u003c?php\n$post-\u003etitle = Input::field(\n    'title',\n    [\n        'required' =\u003e 'The title is required.',\n        'min:3'    =\u003e 'The title needs to be atleast 3 characters long.',\n    ]\n);\n\n$post-\u003esave();\n```\nThe supported rules can be found in the `Rule` class. At the time of writing, the following rules are supported:\n- min\n- max\n- required\n- email\n- url\n- digits\n- alpha\n\nIf validation fails, kiwi will redirect back with access to an `$errors` variable, containing all the data you need to display an informative error message!\n\n## License\nKiwi is MIT licensed, meaning you are free modify and do as you wish with the code.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakobjohansson%2Fkiwi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjakobjohansson%2Fkiwi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakobjohansson%2Fkiwi/lists"}