{"id":26849591,"url":"https://github.com/ziming/json-field-for-backpack","last_synced_at":"2025-04-06T22:06:04.464Z","repository":{"id":46065651,"uuid":"308058585","full_name":"ziming/json-field-for-backpack","owner":"ziming","description":"Json Field for Laravel Backpack","archived":false,"fork":false,"pushed_at":"2024-11-23T18:04:39.000Z","size":43,"stargazers_count":34,"open_issues_count":1,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-02T23:05:43.993Z","etag":null,"topics":["hacktoberfest","laravel","laravel-backpack","laravel-package","php"],"latest_commit_sha":null,"homepage":"","language":"Blade","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/ziming.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":null,"funding":".github/FUNDING.yml","license":"license.md","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},"funding":{"github":["ziming"]}},"created_at":"2020-10-28T15:24:43.000Z","updated_at":"2024-11-23T18:03:44.000Z","dependencies_parsed_at":"2024-08-14T10:08:36.350Z","dependency_job_id":"b7bff36b-5c97-43f5-9bbe-eca99c4d323f","html_url":"https://github.com/ziming/json-field-for-backpack","commit_stats":{"total_commits":18,"total_committers":4,"mean_commits":4.5,"dds":0.6111111111111112,"last_synced_commit":"80c20c0a5528f846f8c3416c85f7969bdfb64281"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziming%2Fjson-field-for-backpack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziming%2Fjson-field-for-backpack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziming%2Fjson-field-for-backpack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziming%2Fjson-field-for-backpack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ziming","download_url":"https://codeload.github.com/ziming/json-field-for-backpack/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247557767,"owners_count":20958047,"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":["hacktoberfest","laravel","laravel-backpack","laravel-package","php"],"created_at":"2025-03-30T21:36:46.245Z","updated_at":"2025-04-06T22:06:04.429Z","avatar_url":"https://github.com/ziming.png","language":"Blade","funding_links":["https://github.com/sponsors/ziming"],"categories":[],"sub_categories":[],"readme":"# JSON Field for Backpack 5 and 6\n\n[![Latest Version on Packagist][ico-version]][link-packagist]\n[![Total Downloads][ico-downloads]][link-downloads]\n\nThis package provides a ```json``` field type for the [Backpack for Laravel](https://backpackforlaravel.com/) administration panel. The field allows the admin to manually edit the contents of a column where a JSON is stored, using the [`josdejong/jsoneditor`](https://github.com/josdejong/jsoneditor) JS plugin. That means they'll have:\n- multiple modes of viewing the JSON (code, tree, form)\n- syntax highlighting\n- indented code\n- color picker\n- searching\n- undo \u0026 redo\n- etc.\n\nOf course, this field should only be used when the admin is savvy enough to know what JSON is. Otherwise they can completely mess up the structure/format of the JSON stored in the database column.\n\n## Screenshots\n\n![https://user-images.githubusercontent.com/1032474/97699650-e2e92b80-1a80-11eb-8320-3ac35e8a59a1.gif](https://user-images.githubusercontent.com/1032474/97699650-e2e92b80-1a80-11eb-8320-3ac35e8a59a1.gif)\n\nBackpack v6 with Tabler, light and dark modes\n![https://github.com/ziming/json-field-for-backpack/assets/82019078/bdd36562-d46c-4966-ad02-4e765675eae4](https://github.com/ziming/json-field-for-backpack/assets/82019078/bdd36562-d46c-4966-ad02-4e765675eae4)\n\n## Installation\n\nVia Composer\n\n``` bash\ncomposer require ziming/json-field-for-backpack\n```\n\n## Usage\n\nInside your custom CrudController:\n\n```php\n$this-\u003ecrud-\u003eaddField([\n    'name'  =\u003e 'column_name',\n    'type'  =\u003e 'json',\n    'view_namespace' =\u003e 'json-field-for-backpack::fields',\n    \n    // OPTIONAL\n    \n    // Which modes should the JsonEditor JS plugin allow?\n    // Please note that the first mode in the array will be used as the default mode.\n    'modes' =\u003e ['form', 'tree', 'code'],\n     \n    // Default value, if needed. If there is an actual value in the json column, \n    // it will do an array_merge_recursive(), with the json column values \n    // replacing the ones with the same keys.\n    'default' =\u003e [],\n]);\n```\n\nNotice the ```view_namespace``` attribute - make sure that is exactly as above, to tell Backpack to load the field from this _addon package_, instead of assuming it's inside the _Backpack\\CRUD package_.\n\n\n## Overwriting\n\nIf you need to change the field in any way, you can easily publish the file to your app, and modify that file any way you want. But please keep in mind that you will not be getting any updates.\n\n**Step 1.** Copy-paste the blade file to your directory:\n```bash\n# create the fields directory if it's not already there\nmkdir -p resources/views/vendor/backpack/crud/fields\n\n# copy the blade file inside the folder we created above\ncp -i vendor/ziming/json-field-for-backpack/src/resources/views/fields/json.blade.php resources/views/vendor/backpack/crud/fields/json.blade.php\n```\n\n**Step 2.** Remove the vendor namespace wherever you've used the field:\n```diff\n$this-\u003ecrud-\u003eaddField([\n-   'view_namespace' =\u003e 'json-field-for-backpack::fields'\n]);\n```\n\n**Step 3.** Uninstall this package. Since it only provides one file - ```json.blade.php```, and you're no longer using that file, it makes no sense to have the package installed:\n\n```bash\ncomposer remove ziming/json-field-for-backpack\n```\n\n## Change log\n\nPlease see the [changelog](changelog.md) for more information on what has changed recently.\n\n\n## Security\n\nIf you discover any security related issues, please email [the author](composer.json) instead of using the issue tracker.\n\n## Credits\n\n- [ziming](https://github.com/ziming) - Created the initial field type\n- [vesper8](https://github.com/vesper8) - Polished \u0026 fixed bugs in the field type to allow multiple instances of the field\n- [stephanus-stuff](https://github.com/stephanus-stuff) - For updating the field type to be compatible with Backpack 4.0 and 4.1\n- [Cristian Tabacitu](https://github.com/tabacitu) - For creating Backpack.\n- [josdejong](https://github.com/josdejong) - For creating [jsoneditor](https://github.com/josdejong/jsoneditor)\n\n- [All Contributors][link-contributors]\n\n## License\n\nMIT. Please see the [license file](license.md) for more information.\n\n[ico-version]: https://img.shields.io/packagist/v/ziming/json-field-for-backpack.svg?style=flat-square\n[ico-downloads]: https://img.shields.io/packagist/dt/ziming/json-field-for-backpack.svg?style=flat-square\n\n[link-packagist]: https://packagist.org/packages/ziming/json-field-for-backpack\n[link-downloads]: https://packagist.org/packages/ziming/json-field-for-backpack\n[link-author]: https://github.com/ziming\n[link-contributors]: ../../contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fziming%2Fjson-field-for-backpack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fziming%2Fjson-field-for-backpack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fziming%2Fjson-field-for-backpack/lists"}