PHPackages                             kaleidpixel/geoipallow - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. kaleidpixel/geoipallow

ActiveLibrary[Security](/categories/security)

kaleidpixel/geoipallow
======================

A streamlined tool designed to generate .htaccess configurations, allowing web access exclusively from IP addresses of a specified country. Enhance your site's security and target your audience more effectively.

1.0.0(2y ago)091MITPHPPHP ^7.3||^8.0

Since Oct 5Pushed 2y ago1 watchersCompare

[ Source](https://github.com/kaleidpixel/geoipallow)[ Packagist](https://packagist.org/packages/kaleidpixel/geoipallow)[ RSS](/packages/kaleidpixel-geoipallow/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (1)

Geo IP Allow
============

[](#geo-ip-allow)

A streamlined tool designed to generate .htaccess configurations, allowing web access exclusively from IP addresses of a specified country. Enhance your site's security and target your audience more effectively.

Document
========

[](#document)

Coding is quite simple. The options are only simple, so you won't get lost.

Options
-------

[](#options)

OptionDescription**server**
*default: apache*Apache or Nginx**ipv**
*default: 0*Specify the version of the IP Address with a single digit (4 or 6).**country**
*default: US*Specify the name of the country using the ISO code (Alpha-2 code) as defined in the ISO 3166 international standard.**output\_path**
*default: empty*File path including the name of the file to output the results.**add\_before\_str**
*default: empty*.**add\_after\_str**
*default: empty*.Methods
-------

[](#methods)

MethodParameterDescription**read()**bool $echo = false
bool $force = falseCreate a list of IP addresses. If already created, cache it for one day.**delete()**noneDelete the IP address added with the read method.**ipListEndPoints()**noneWrapper method for the constant IP\_LIST\_ENDPOINTS.**getCIDRRangeIPv4()**int $range = 0Calculate CIDR.**is\_cli()**noneCheck if the type of interface between the web server and PHP is CLI.**curl\_get\_content()**string $url = ''
array $header = \[\]
string $method = 'GET'
array $data = \[\]Retrieve the HTTP code and content of the specified URL.**download()**string $file\_path = ''
string $mime\_type = nullOutput the header in the web browser to download the file and initiate the file download.Basic markup
------------

[](#basic-markup)

What follows is the simplest coding.

### Example 1

[](#example-1)

```
