Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nabeghe/servery-php
Provides easy access to certain details available in the global $_SERVER variable.
https://github.com/nabeghe/servery-php
php php-ip php-lib php-libraries php-library php-server user-agent useragent
Last synced: 21 days ago
JSON representation
Provides easy access to certain details available in the global $_SERVER variable.
- Host: GitHub
- URL: https://github.com/nabeghe/servery-php
- Owner: nabeghe
- License: mit
- Created: 2024-10-23T17:32:23.000Z (27 days ago)
- Default Branch: master
- Last Pushed: 2024-10-23T17:36:20.000Z (27 days ago)
- Last Synced: 2024-10-23T23:32:35.202Z (27 days ago)
- Topics: php, php-ip, php-lib, php-libraries, php-library, php-server, user-agent, useragent
- Language: PHP
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Servery for PHP.
> Provides easy access to certain details available in the global $_SERVER variable.
## 🫡 Usage
### 🚀 Installation
You can install the package via composer:
```bash
composer require nabeghe/servery
```
#### Example:
```php
use Nabeghe\Servery\Servery;
use Nabeghe\Servery\UserAgent;
use Nabeghe\Servery\WebServer;echo "[[ Servery ]]\n
";
echo "Client IP = ".json_encode(Servery::getClientIP())."\n
";
echo "Server IP = ".json_encode(Servery::getServerIP())."\n
";
echo "Host Address = ".json_encode(Servery::getHostAddress())."\n
";
echo "Domain = ".json_encode(Servery::getDomain())."\n
";
echo "HTTPS = ".json_encode(Servery::isHttps())."\n
";
echo "URL Protocol = ".json_encode(Servery::getUrlProtocol())."\n
";
echo "Server Protocol = ".json_encode(Servery::getServerProtocol())."\n
";
echo "URL Scheme = ".json_encode(Servery::getUrlScheme())."\n
";
echo "Root URL = ".json_encode(Servery::getRootUrl())."\n
";
echo "Current URL = ".json_encode(Servery::getCurrentUrl())."\n
";
echo "Requested URL = ".json_encode(Servery::getRequestedUrl())."\n
"; // An alias for getRequestedUrl
echo "Requested Path = ".json_encode(Servery::getRequrestedPath())."\n
";
echo "Home URL = ".json_encode(Servery::getHomeUrl())."\n
";
echo "\n
";echo "[[ UserAgent Handler ]]\n
";
echo "UserAgent = ".json_encode(UserAgent::getCurrent())."\n
";
echo "Browser Name = ".json_encode(UserAgent::detectBrowserName(UserAgent::getCurrent()))."\n
";
echo "Hash = ".json_encode(UserAgent::generateHash())."\n
";
echo "Simple Hash = ".json_encode(UserAgent::generateSimpleHash())."\n
";
echo "Is Bot = ".json_encode(UserAgent::detectBot())."\n
";
echo "Is Mobile = ".json_encode(UserAgent::detectMobile())."\n
";
echo "\n
";echo "[[ UserAgent Handler Object ]]\n
";
echo "UserAgent = ".json_encode(UserAgent::instance()->getValue())."\n
";
echo "Browser Name = ".json_encode(UserAgent::instance()->getBrowserName())."\n
";
echo "Hash = ".json_encode(UserAgent::instance()->getHash())."\n
";
echo "Simple Hash = ".json_encode(UserAgent::instance()->getSimpleHash())."\n
";
echo "Is Bot = ".json_encode(UserAgent::instance()->isBot())."\n
";
echo "Is Mobile = ".json_encode(UserAgent::instance()->isMobile())."\n
";
echo "\n
";echo "[[ WebServer Checker ]]\n
";
echo "Name = ".json_encode(WebServer::getName())."\n
";
echo "Is Apache = ".json_encode(WebServer::isApache())."\n
";
echo "Is IIS = ".json_encode(WebServer::isIIS())."\n
";
echo "Is IIS7 = ".json_encode(WebServer::isIIS7())."\n
";
echo "Is Litespeed = ".json_encode(WebServer::isLitespeed())."\n
";
echo "Is Nginx = ".json_encode(WebServer::isNginx())."\n
";
echo "Is PhpStorm = ".json_encode(WebServer::isPhpStorm())."\n
";
echo "\n
";
```
## 📖 License
Copyright (c) Hadi Akbarzadeh
Licensed under the MIT license, see [LICENSE.md](LICENSE.md) for details.