{"id":20397207,"url":"https://github.com/litstack/meta","last_synced_at":"2026-02-25T05:32:09.036Z","repository":{"id":43679762,"uuid":"341019182","full_name":"litstack/meta","owner":"litstack","description":"A package to easily add meta for crud models and forms.","archived":false,"fork":false,"pushed_at":"2025-04-14T12:19:00.000Z","size":729,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-24T14:38:22.612Z","etag":null,"topics":[],"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/litstack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/funding.yml","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,"zenodo":null},"funding":{"github":["litstack"]}},"created_at":"2021-02-21T22:34:47.000Z","updated_at":"2025-04-14T12:18:40.000Z","dependencies_parsed_at":"2024-11-15T04:12:43.412Z","dependency_job_id":"1caf692f-0b0e-4b42-9079-4922aa3d8439","html_url":"https://github.com/litstack/meta","commit_stats":{"total_commits":26,"total_committers":4,"mean_commits":6.5,"dds":"0.46153846153846156","last_synced_commit":"fdadd5827b643e70f82872e2ce18d08591ab0e42"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/litstack/meta","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litstack%2Fmeta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litstack%2Fmeta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litstack%2Fmeta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litstack%2Fmeta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/litstack","download_url":"https://codeload.github.com/litstack/meta/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litstack%2Fmeta/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29811540,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T03:30:18.102Z","status":"ssl_error","status_checked_at":"2026-02-25T03:30:17.799Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-15T04:12:31.466Z","updated_at":"2026-02-25T05:32:08.999Z","avatar_url":"https://github.com/litstack.png","language":"PHP","funding_links":["https://github.com/sponsors/litstack"],"categories":[],"sub_categories":[],"readme":"# Litstack Meta\n\nEdit default meta-fields inside your crud-models and forms and receive them in your blade templates.\n\n## Installation\n\nThe package can be installed via composer and will autoregister.\n\n```bash\ncomposer require litstack/meta\n```\n\nYou can now publish and migrate the migration for your meta model:\n\n```shell\nphp artisan vendor:publish --provider=\"Litstack\\Meta\\MetaServiceProvider\" --tag=migrations\nphp artisan migrate\n```\n\n## Usage\n\nStart by perparing your Crud-Model by using the `HasMeta` Trait and implement the `metaable` Contract:\n\n```php\nuse Litstack\\Meta\\Metaable;\nuse Litstack\\Meta\\Traits\\HasMeta;\n\nclass Post extends Model implements Metaable\n{\n    use HasMeta;\n}\n```\n\nIn order to display the form in litstack edit your model-config:\n\n```php\n\npublic function show() \n{\n    $page-\u003ecard(function($form) {\n        $form-\u003eseo();\n    });\n}\n        \n\n```\n\nTo display the meta-fields in your template, simply use the `\u003cx-lit-meta /\u003e` component and pass it the `metaFields` of your model.\n\n```php\n@extends('app')\n\n@section('meta')\n    \u003cx-lit-meta :for=\"$post\" /\u003e\n@endsection\n```\n\nAnd in your main template:\n\n```php\n\u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"\u003e\n    \u003cmeta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\"\u003e\n    @yield('meta')\n\u003c/head\u003e\n```\n\n## Default Values / Customizing / Overriding\n\nIf you want to use meta attributes directly from model attributes you can specify them in `metaAttributes` in your config. You may as well override the meta methods like `metaAuthor` to return dynamic meta attributes:\n\n```php\nclass Post extends Model implements Metaable\n{\n    use HasMeta;\n\n    protected $metaAttributes = [\n        'author' =\u003e 'author.name',\n        'image'  =\u003e 'header_image',\n    ];\n\n    public function getHeaderImageAttribute()\n    {\n        // ...\n    }\n\n    public function metaTitle(): ?string\n    {\n        // Return a prefix:\n        return \"Awesome Blog: \" . parent::metaTitle();\n    }\n}\n```\n\nYou may set default attributes by setting `defaultMetaAttributes` or add a method `defaultMeta...` method:\n\n```php\nclass Post extends Model implements Metaable\n{\n    use HasMeta;\n\n    protected $defaultMetaAttribute = [\n        'description' =\u003e 'description',\n    ];\n\n    public function defaultMetaTitle()\n    {\n\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flitstack%2Fmeta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flitstack%2Fmeta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flitstack%2Fmeta/lists"}