Download the PHP package jaaulde/php-ipv4 without Composer

On this page you can find all versions of the php package jaaulde/php-ipv4. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-ipv4

php-ipv4

Build Status Scrutinizer Code Quality Coverage Status Latest Version on Packagist Total Downloads

PHP classes for working with IPV4 addresses and networks.

Install

via composer

Change log

Please see CHANGELOG for information about what has changed recently.

Testing

License

The MIT License (MIT). Please see License File for more information.

Usage

...

Examples

_Warning: These examples are simplified and without context. Usage of unfiltered/unvalidated request variables (such as from $_POST) in these examples is not an endoresement or recommendation to do so in your own projects._

Hard Coded Whitelist

DB Driven Address Blocking

Many PHP applications allow administrators to blacklists for ranges of abusive IPs to ease moderator work loads. Most of these applications use overly complicated db schemas to store the IP addresses which represent the ranges, and use a series of string manipulations to determine if IPs fall into the banned ranges. By applying the actual math and logic involved in the IPv4 address scheme, php-ipv4 radically simplifies all of this, and provides a more reliable filtering of IPs.

An example administrator interface may offer a form something like this for entering ranges to ban:

The receiving PHP script, ip-ban.php would then do something like this:

Supposing the Range instance was properly created, we could move on to store it. This is where php-ipv4 really begins to stand out. Rather than store some string representation of the IP in a database for later retrieval and comparison gyrations, php-ipv4 lets us easily store the integer representation of the IP in database columns for later querying using a BETWEEN clause.

Given a database table with integer values representing the first and last IP addresses in blocked ranges:

We could ask the range for the integer value of its first and last addresses and store those.

Finally, when we want to check if a client's IP address is one which is blocked, we can simply query like so:

If the above query returns a count greater than 0, you know that the client's IP address is on a ban list. Otherwise, they're allowed to continue. It's that simple--there is no need ask for the actual data in the rows or iterate and compare.

That's not all, though. A better admin interface would allow you to specify any IP and a subnet mask in dot notation or CIDR. php-ipv4 can make that a breeze as well. Given the same DB schema as before and a form that would POST address and mask to ip-ban.php, you could simply:

The check for whether a client IP was blacklisted would then be identical to the already given example for such.


All versions of php-ipv4 with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jaaulde/php-ipv4 contains the following files

Loading the files please wait ....