Download the PHP package rumenx/php-geolocation without Composer

On this page you can find all versions of the php package rumenx/php-geolocation. 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?
rumenx/php-geolocation
Rate from 1 - 5
Rated 5.00 based on 1 reviews

Informations about the package php-geolocation

php-geolocation

Test Analyze Style codecov

A simple, framework-agnostic PHP utility for Cloudflare geolocation detection and client information extraction. Provides helpers to access geolocation, language, and client information (OS, browser, device, resolution) from HTTP headers.

Features

๐Ÿ“š Documentation & Wiki

For comprehensive documentation, examples, and advanced usage patterns, visit our Complete Wiki Documentation:

๐Ÿš€ Quick Links

๐Ÿ“– Advanced Topics

Why This Design?

This package is intentionally designed as a simple utility library rather than a complex framework integration. Here's why:

๐ŸŽฏ Focused Purpose

๐Ÿ”ง Easy Integration

๐Ÿ“ฆ Minimal Dependencies

This approach makes the package more reliable, easier to understand, and simpler to maintain - following the Unix philosophy of "do one thing and do it well."

Installation

Local Development Simulation

When developing locally where Cloudflare is not available, you can simulate its functionality:

Quick Simulation

Advanced Simulation

Auto-Detection of Local Environment

Available Countries for Simulation

Framework Integration for Development

For Laravel and Symfony, check the /examples directory for middleware and event listeners that automatically inject simulated Cloudflare headers in development environments.

Usage

Basic Usage

Language Detection

Client Information

Framework Integration Examples

Laravel

Symfony

Plain PHP

Configuration

The package is simple and requires minimal configuration. All settings are passed directly to the constructor:

Constructor Parameters

Country-to-Language Mapping

Map country codes (ISO 3166-1 alpha-2) to language codes or arrays. The first language is the default for the country:

Example Configurations

Minimal Setup

Basic Country Mapping

Custom Cookie Name

Full Configuration

No configuration files, service providers, or complex setup needed!

Examples

The examples/ directory contains practical demonstrations of the package capabilities:

๐ŸŽฏ Basic Usage

โšก Framework Integration

๐ŸŒ Real-World Applications

Running Examples

All examples automatically detect local development and use simulation, so they work perfectly without Cloudflare setup! ๐Ÿš€

Contributing

We welcome contributions! Please see our Contributing Guide for details on how to contribute to this project.

Code of Conduct

This project adheres to a Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to the project maintainers.

Development

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests: composer test
  5. Run static analysis: composer analyze
  6. Check code style: composer style
  7. Submit a pull request

Related Projects

๐Ÿน Go Version

๐Ÿ”ฎ Future Versions (Planned)

Security

If you discover a security vulnerability, please see our Security Policy for information on how to report it responsibly.

Changelog

All notable changes to this project are documented in the Changelog.

Support

License

MIT


All versions of php-geolocation with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
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 rumenx/php-geolocation contains the following files

Loading the files please wait ....