{"id":18310305,"url":"https://github.com/torann/device-view","last_synced_at":"2025-08-08T04:12:25.496Z","repository":{"id":35435128,"uuid":"39701325","full_name":"Torann/device-view","owner":"Torann","description":"Dynamically change Laravel views based on the visitor's device.","archived":false,"fork":false,"pushed_at":"2018-02-01T20:02:09.000Z","size":14,"stargazers_count":14,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-22T18:53:04.987Z","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":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Torann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-25T20:09:37.000Z","updated_at":"2023-12-29T18:34:32.000Z","dependencies_parsed_at":"2022-09-17T19:04:05.117Z","dependency_job_id":null,"html_url":"https://github.com/Torann/device-view","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/Torann/device-view","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Torann%2Fdevice-view","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Torann%2Fdevice-view/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Torann%2Fdevice-view/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Torann%2Fdevice-view/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Torann","download_url":"https://codeload.github.com/Torann/device-view/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Torann%2Fdevice-view/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269361745,"owners_count":24404403,"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-08-08T02:00:09.200Z","response_time":72,"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-05T16:14:01.658Z","updated_at":"2025-08-08T04:12:25.473Z","avatar_url":"https://github.com/Torann.png","language":"PHP","funding_links":["https://www.patreon.com/torann","https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=4CJA2A97NPYVU"],"categories":[],"sub_categories":[],"readme":"# Laravel Device View\n\n[![Total Downloads](https://poser.pugx.org/torann/geoip/downloads.png)](https://packagist.org/packages/torann/device-view)\n[![Patreon donate button](https://img.shields.io/badge/patreon-donate-yellow.svg)](https://www.patreon.com/torann)\n[![Donate weekly to this project using Gratipay](https://img.shields.io/badge/gratipay-donate-yellow.svg)](https://gratipay.com/~torann)\n[![Donate to this project using Flattr](https://img.shields.io/badge/flattr-donate-yellow.svg)](https://flattr.com/profile/torann)\n[![Donate to this project using Paypal](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=4CJA2A97NPYVU)\n\n- [Device View on Packagist](https://packagist.org/packages/torann/device-view)\n- [Device View on GitHub](https://github.com/Torann/device-view)\n\nDynamically change Laravel views based on the visitor's device.\n\n## Installation\n\n### Composer\n\nFrom the command line run:\n\n```\ncomposer require torann/device-view\n```\n\n### Setup\n\nThis package extends Laravel's built in `ViewServiceProvider`, so that provider must be replaced in `app/app.php`.\nReplace the instance of `'Illuminate\\View\\ViewServiceProvider',` with `'Torann\\DeviceView\\DeviceViewServiceProvider',`.\n\n\n### Publish the configurations\n\nRun this on the command line from the root of your project:\n\n```\n$ php artisan vendor:publish --provider=\"Torann\\DeviceView\\DeviceViewServiceProvider\"\n```\n\nA configuration file will be publish to `config/device-view.php`.\n\n\n## Configuration\n\nThe default settings are for the device views to be in the `views` directory in `resources/` with the default theme called `default`.\n\n```\nresources/\n    views/\n        default/\n        mobile/\n        tablet/\n```\n\n## Usage\n\nA standard call to `View::make('index')` will look for an index view in `resources/views/default/`. However, if a theme is specified with\n`$app['view.finder']-\u003esetDeviceView('mobile');` prior to calling `View::make()` then the view will first be looked for in `resources/views/mobile/views`.\nIf the view is not found for the current theme the default theme will then be searched.\n\n### Facade\n\nThe `DeviceView` facade can also be used if preferred `DeviceView::setDeviceView('mobile')` by adding an entry for `Torann\\DeviceView\\Facades\\DeviceView` to `config/app.php`.\n\n### Helper Methods\n\n**DeviceView::getPlatform()**\n\nReturn the user's operating system.\n\n## Example\n\nGiven a directory structure of:\n\n```\nresources/\n    views/\n        default/\n            layout.blade.php\n            admin.blade.php\n        mobile/\n            layout.blade.php\n```\n\n```\nView::make('layout'); // Loads resources/views/default/layout.blade.php\n\n$app['view.finder']-\u003esetDeviceView('default');\n\nView::make('layout'); // Loads resources/views/mobile/layout.blade.php\nView::make('admin'); // Loads resources/views/default/admin.blade.php\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftorann%2Fdevice-view","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftorann%2Fdevice-view","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftorann%2Fdevice-view/lists"}