{"id":33977595,"url":"https://github.com/aknife2019/agent","last_synced_at":"2025-12-13T02:29:14.792Z","repository":{"id":56943437,"uuid":"187389506","full_name":"aknife2019/agent","owner":"aknife2019","description":"判断设备类型的 composer包","archived":false,"fork":false,"pushed_at":"2022-06-09T07:21:03.000Z","size":359,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-27T06:38:08.949Z","etag":null,"topics":["agent","php","useragent"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/aknife2019.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":"2019-05-18T17:58:13.000Z","updated_at":"2025-05-16T03:40:22.000Z","dependencies_parsed_at":"2022-08-21T07:50:28.831Z","dependency_job_id":null,"html_url":"https://github.com/aknife2019/agent","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/aknife2019/agent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aknife2019%2Fagent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aknife2019%2Fagent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aknife2019%2Fagent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aknife2019%2Fagent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aknife2019","download_url":"https://codeload.github.com/aknife2019/agent/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aknife2019%2Fagent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27698682,"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-12-13T02:00:09.769Z","response_time":147,"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":["agent","php","useragent"],"created_at":"2025-12-13T02:29:10.950Z","updated_at":"2025-12-13T02:29:14.787Z","avatar_url":"https://github.com/aknife2019.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Agent\n=====\n规则更新于 2022年4月28日\n\n安装\n------------\n\n使用 composer:\n\n```bash\ncomposer require aknife/agent\n```\n\n### 基础用法\n-----------\n\n```php\nuse Aknife\\Agent\\Agent;\n```\n------------------------\n\n### 设置返回的语言\n如果未设置，默认调用中文\n```php\nAgent::lang('en'); // zh_cn / zh_tw / en\n\n```\n\n### 解析特定的 header\n\n```php\nAgent::setUserAgent('Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X; zh-CN) AppleWebKit/537.51.1 (KHTML, like Gecko) Mobile/14G60 UCBrowser/11.7.7.1031 Mobile AliApp(TUnionSDK/0.1.20)');\n```\n\n### 解析特定的 IP\n\n```php\nAgent::ip('159.75.190.197');\n/*\n[\n    'continent' =\u003e [\n            'code' =\u003e 'AS',\n            'name' =\u003e '亚洲',\n    ],\n    'country' =\u003e [\n            'code' =\u003e 'CN',\n            'name' =\u003e '中国',\n    ],\n    'region' =\u003e '广东省',\n    'city' =\u003e '广州市',\n]\n*/\n```\n\n### 浏览器的语言\n\n```php\nAgent::languages(); // return \"zh-CN/zh-TW/en-US\";\n```\n\n### 操作系统\n\n获取操作系统 Windows7 / Windows10 / Mac OS / FreeBSD / Linux，如果是手机，则获取 andorid / iphone /\n\n```php\nAgent::platform();  //  ['name'=\u003e'Windows','version'=\u003e'10']\n```\n\n### 浏览器名称\n\n获取浏览器的名称. (谷歌浏览器 / IE 浏览器 / Edge 浏览器 / 苹果浏览器 / 火狐浏览器 / 华为浏览器 / 小米浏览器 / QQ内置浏览器 / 微信内置浏览器 / QQ浏览器 / ...)\n\n```php\n$browser = Agent::browser(); // [ 'name'=\u003e'Chrome','version'=\u003e'74.0','full'=\u003e'74.0.3729.131' ]\n\n```\n\n### 设备名称\n\n获取设备名称\n\n```php\nAgent::device();    //  ['model'=\u003e'honor V10','brand'=\u003e'Huawei','category'=\u003e'smartphone']\n```\n\n### 机器人名称\n\n获取机器人名称. (百度蜘蛛 / Curl / Python / Java ...),如果存在验证规则，则判断蜘蛛真假\n\n```php\nAgent::robot(); // ['name'=\u003e'Baidu Spider','category'=\u003e'Search bot','checked'=\u003e'false']\n```\n\n### 其他用法\n```php\nAgent::setIp('8.8.8.8');\nAgent::isMobile();\nAgent::isMobileApp();\nAgent::isTablet();\n```\n\n## License\n\nLaravel User Agent is licensed under [The MIT License (MIT)](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faknife2019%2Fagent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faknife2019%2Fagent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faknife2019%2Fagent/lists"}