{"id":19081863,"url":"https://github.com/tacone/coffee","last_synced_at":"2025-10-04T05:26:26.268Z","repository":{"id":26285910,"uuid":"29733511","full_name":"tacone/coffee","owner":"tacone","description":"Work in progress form builder for Laravel","archived":false,"fork":false,"pushed_at":"2015-09-26T22:52:15.000Z","size":508,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-08T05:31:53.150Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/tacone.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}},"created_at":"2015-01-23T13:26:39.000Z","updated_at":"2023-03-08T04:36:09.000Z","dependencies_parsed_at":"2022-08-26T21:20:00.114Z","dependency_job_id":null,"html_url":"https://github.com/tacone/coffee","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tacone/coffee","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tacone%2Fcoffee","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tacone%2Fcoffee/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tacone%2Fcoffee/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tacone%2Fcoffee/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tacone","download_url":"https://codeload.github.com/tacone/coffee/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tacone%2Fcoffee/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278267341,"owners_count":25958828,"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","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-09T02:39:37.247Z","updated_at":"2025-10-04T05:26:26.249Z","avatar_url":"https://github.com/tacone.png","language":"PHP","readme":"# Coffee\n\nCoffee is a one-stop laravel CRUD solution.\n\nThis library is inspired by the [Rapyd](https://github.com/zofe/rapyd-laravel)\npackage and aims to become a widget library decoupled from pre-made\nbackends, to allow a developer to quickly build record listings\nand forms with creation, editing and deletion in few lines\nof code.\n\nFor the most basic cases, a generic view and two controller methods \nwould suffice for a single crud: one for the record list, one for the\nediting form.\n\nEloquent relations will be fully supported with the possible\nexception of polymorphic relations (still to be seen).\n\n## Principles\n\n- require as few lines of code as possible for basic cases\n- let developers use one generic container view for all the CRUDs\n- customization via public methods/attributes and callbacks\nrather than class extension\n- fractal (nested) automation/overrides\n- make it easy to create custom field types that work\n- jump off the ajax bandwagon where possible. As less javascript\nas possible. Allow ajax-form and instantclick use for those\ninterested\n- little or no configuration\n- allow the use blade and twig, don't depend on them\n\n## Requirements\n\n- Laravel 4.2 (untested on 4.1)\n- PHP 5.4+ (we use traits extensively)\n\n## Installation\n\nAdd the package to composer `composer.json`:\n\n```\n\"tacone/coffee\": \"dev-master\"  \n```\n\nThen add the coffee provider to the providers list in\n `app/config/app.php`:\n   \n```\n'Tacone\\Coffee\\CoffeeServiceProvider',\n```\n\nthen run: `composer update tacone/coffee`.\n\nTo try the demos add this line to `routes.php`:\n\n```php\nRoute::controller('/demo', 'Tacone\\Coffee\\Demo\\Controllers\\DemoController');\n```\n\nThen point your browser to `http://\u003cpublicurl\u003e/demo`. You will then be able\nto setup the required tables by following the `setup` link.\n\n## Usage\n\nCoffee is made up of a handfew standalone widgets.\n\n### DataForm\n\nThe dataform is a stateless form-builder that accepts a datasource \nas argument.\n\nYou can use it to build, validate and save forms with ease, while \nretaining control over each phase of the life-cycle.\n\nA sample contact form may look like the example below:\n\n```php\n// definition\n$model = new Message(); //an eloquent model\n$form = new DataForm($model);\n$form-\u003etext('title')-\u003erule('required');\n$form-\u003etext('mail', 'Your mail address')-\u003erule('required|email');\n$form-\u003etextarea('message')-\u003erule('min:20');\n\n// read the user submission from Input\n$form-\u003epopulate();\n\n// set the value of the fields in the model\n$form-\u003ewriteSource();\n\n// validate only when form has been submitted\nif ($form-\u003esubmitted() \u0026\u0026 $form-\u003evalidate()) {\n    // save the message in the database\n    $form-\u003esave();\n    // do something, for example send it via mail\n    // then redirect to the homepage\n    return Response::redirect('/');\n}\nreturn View::make(\"contact-us\", compact('form'));\n```\n\nAs you see very few lines of code are needed. To save even more\ntyping, you can use the DataEdit, which has a similar syntax, but\nautomates everything but the building part.\n\nYou can then simply print your form inside `contact-us.blade.php`:\n\n```\n{{ $form }}\n```\n\nBut you could instead customize it more by printing each component\nseparately:\n\n```\n{{ $form-\u003estart }}\n\u003cdiv class=\"alert alert-success\"\u003eMy custom message :))\u003c/div\u003e\n{{ $form-\u003efields }}\n{{ $form-\u003eend }}\n```\n\nOr even more!\n\n```\n{{ $form-\u003estart }}\n\u003c!-- Look ma', customization! --\u003e\n\u003cp\u003e\u003cem\u003eThis is a simple form printed in a custom view.\u003c/em\u003e\u003c/p\u003e\n\n@foreach($form as $field)\n    @if ($field-\u003ename() == 'title'\n        {{ $tfield-\u003estart }}\n        {{ $field-\u003elabel }}\n        \u003cp\u003e\u003cem\u003eTry to choose a nice title :)\u003c/em\u003e\u003c/p\u003e\n        {{ $field-\u003econtent() }}\n        {{ $field-\u003eerrors() }}\n        {{ $field-\u003eend }}\n    @else\n        {{ $field }}\n    @endif\n@endforeach\n\u003cp\u003e Click the button! \u003c/p\u003e\n{{ $form-\u003eend }}\n```\n\nThe bottom line is you can choose the level of customization without\nunnecessary logic duplication.\n\n## Contributing\n\nI welcome pull requests. Please try to send PSR-2 compliant code.\n\nThe suggested method to conform to PSR-2 is installing \n[PSR Police](https://github.com/tacone/psr-police) and using it\nto set a pre-commit git hook.\n\n## Unit tests\n\nThere are no tests at the moment, as I feel it's too soon and the\ndesign of this package may change sensibly as the development goes on.\n\nHopefully, as the API becomes stable, I will write some.\n\n## License\n\nYou are permitted to use this library under the terms of the MIT license.\n\nSome code comes from third-party libraries:\n\n- the Documenter class and the demo models/migrations/seeds are derived from the\n[Rapyd](https://github.com/zofe/rapyd-laravel) package by Felice Ostuni\n- some methods taken from the [Laravel framework](https://github.com/laravel/laravel)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftacone%2Fcoffee","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftacone%2Fcoffee","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftacone%2Fcoffee/lists"}