{"id":20397190,"url":"https://github.com/litstack/wikipedia-field","last_synced_at":"2025-12-06T04:02:10.197Z","repository":{"id":48582779,"uuid":"379558988","full_name":"litstack/wikipedia-field","owner":"litstack","description":null,"archived":false,"fork":false,"pushed_at":"2022-10-28T07:52:31.000Z","size":186,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-16T14:51:33.853Z","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/litstack.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":"2021-06-23T10:06:27.000Z","updated_at":"2022-10-28T07:42:48.000Z","dependencies_parsed_at":"2022-08-30T05:22:27.631Z","dependency_job_id":null,"html_url":"https://github.com/litstack/wikipedia-field","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litstack%2Fwikipedia-field","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litstack%2Fwikipedia-field/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litstack%2Fwikipedia-field/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litstack%2Fwikipedia-field/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/litstack","download_url":"https://codeload.github.com/litstack/wikipedia-field/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241945526,"owners_count":20046869,"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":[],"created_at":"2024-11-15T04:12:09.821Z","updated_at":"2025-12-06T04:02:05.164Z","avatar_url":"https://github.com/litstack.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wikipedia-Field\n\nUse Wikipedia as the source for your content.\n\n## Config\n\nYou can configure the cache time by adding the `wikipedia` settings to the `fields` key in your `config/lit.php`\n\n```php\n'fields' =\u003e [\n    // ...\n    'wikipedia' =\u003e [\n        'cache_ttl' =\u003e 60 * 60 * 24,\n    ],\n],\n```\n\n## Usage\n\nThe wikipedia formfield is used as follows:\n\n```php\n$form-\u003ewikipedia('wiki');\n```\n\nIn your Model you need to provide a json column wich is cast properly:\n\n```php\n// in your model\nprotected $casts = [\n    'wiki' =\u003e 'json',\n];\n```\n\nIf you want to disable the `section` or `chars` inputs you can do it as follows:\n\n```php\n$form-\u003ewikipedia('wiki')-\u003esection(false)-\u003echars(false);\n```\n\n### Displaying Content\n\nIn order to load the content of a wikipedia article you can use the `Wikipedia` facade.\n\n```php\n// will output the first 'intro' section of the article\nWikipedia::load('https://en.wikipedia.org/wiki/PHP');\n```\n\nYou can also select a specific section:\n\n```php\n// will output the 'Mascot' section.\nWikipedia::load('https://en.wikipedia.org/wiki/PHP', 'Mascot');\n```\n\nYou might as well set a maximum amout of characters:\n\n```php\n// will output the first 100 chars of the 'Mascot' section.\nWikipedia::load('https://en.wikipedia.org/wiki/PHP', 'Mascot', 100);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flitstack%2Fwikipedia-field","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flitstack%2Fwikipedia-field","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flitstack%2Fwikipedia-field/lists"}