PHPackages                             softius/cors-proxy - 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. softius/cors-proxy

ActiveLibrary

softius/cors-proxy
==================

PHP CORS Proxy

272719145[10 issues](https://github.com/softius/php-cross-domain-proxy/issues)[7 PRs](https://github.com/softius/php-cross-domain-proxy/pulls)PHP

Since Sep 21Pushed 3y ago23 watchersCompare

[ Source](https://github.com/softius/php-cross-domain-proxy)[ Packagist](https://packagist.org/packages/softius/cors-proxy)[ RSS](/packages/softius-cors-proxy/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHP CORS Proxy
==============

[](#php-cors-proxy)

[![Latest Version on Packagist](https://camo.githubusercontent.com/adde95dd6b14813f168b9f28ad21a15202b73b8961e2701a104e1112380aae71/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736f66746975732f636f72732d70726f78792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/softius/cors-proxy)[![Total Downloads](https://camo.githubusercontent.com/3c3c955f1a9f994805dce95531922e9fdd5eacc4e1ff316af28181bbc2611580/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736f66746975732f636f72732d70726f78792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/softius/cors-proxy)

*Formerly known as "PHP Cross Domain (AJAX) Proxy"*

PHP CORS Proxy is a simple php script that allows cross domain requests. It can be used to access resources from third party websites when it's not possible to enable CORS on target website i.e. when you don't own that website.

**Note**: Please check whether this solution is indeed necessary by having a look on [how you can enable CORS on your server](http://enable-cors.org/server.html).

Overview
--------

[](#overview)

### Features

[](#features)

- Acts as a reverse proxy: request headers and data are propagated from proxy to server. Similarly, response headers and data are propagated from proxy to client.
- Provides support for all methods GET, POST, PUT, DELETE.
- Provides also support for HTTPS.
- Requests can be filtered against a list of trusted domains or URLs.
- External configuration (Work in progress)
- Error handling i.e. when server is not available (Work in progress)
- Debugging mode (Work in progress)

### Requirements

[](#requirements)

PHP Cors Proxy works with PHP 5.3+ or above.

### Author

[](#author)

- [Iacovos Constantinou](https://github.com/softius) -  -
- See also the list of [contributors](../../contributors) which participated in this project.

### License

[](#license)

PHP CORS Proxy is licensed under GPL-3.0. See `LICENCE.txt` file for further details.

Installation
------------

[](#installation)

**Using composer**

```
composer require softius/cors-proxy

```

**Manual installation**

The proxy is indentionally limited to a single file. All you have to do is to place `proxy.php` under the public folder of your application.

### Configuration

[](#configuration)

For security reasons don't forget to define all the trusted domains / URLs into top section of `proxy.php` file:

```
$valid_requests = array(
    'http://www.domainA.com/',
    'http://www.domainB.com/path-to-services/service-a'
);
```

**Note**: There is currently ongoing work to allow configuration outside the `proxy.php`

Usage
-----

[](#usage)

It is possible to initiate a cross domain request either by providing the `X-Proxy-URL` header or by passing a special `GET` parameter. The former method is strongly suggested since it doesn't modify the request query. Also, the request looks more clear and easier to understand.

### Using headers

[](#using-headers)

It is possible to specify the target URL by using the `X-Proxy-URL` header, which might be easier to set with your JavaScript library. For example, if you wanted to automatically use the proxy for external URL targets, for GET and POST requests:

```
$.ajaxPrefilter(function(options, originalOptions, jqXHR) {
    if (options.url.match(/^https?:/)) {
        options.headers['X-Proxy-URL'] = options.url;
        options.url = '/proxy.php';
    }
});
```

The following example uses `curl`

```
curl -v -H "X-Proxy-URL: http://cross-domain.com" http://yourdomain.com/proxy.php

```

### Using query

[](#using-query)

In order to make a cross domain request, just make a request to  and specify the target URL by using the `csurl` (GET) parameter. Obviously, you can add more parameters according to your needs; note that the rest of the parameters will be used in the cross domain request. For instance, if you are using jQuery:

```
$('#target').load(
    'http://www.yourdomain.com/proxy.php', {
        csurl: 'http://www.cross-domain.com/',
        param1: value1,
        param2: value2
    }
);
```

The following example uses `curl`

```
curl -v "http://yourdomain.com/proxy.php?csurl=http://www.cross-domain.com/&param1=value1&param2=value2"

```

###  Health Score

32

—

LowBetter than 71% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community26

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 73% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/4a3ee57baf1b563b35564cb2a0a212012695f630d7c29372d2828595f5d060de?d=identicon)[softius](/maintainers/softius)

---

Top Contributors

[![softius](https://avatars.githubusercontent.com/u/586121?v=4)](https://github.com/softius "softius (27 commits)")[![jweisman](https://avatars.githubusercontent.com/u/80420?v=4)](https://github.com/jweisman "jweisman (3 commits)")[![aaparmeggiani](https://avatars.githubusercontent.com/u/6909?v=4)](https://github.com/aaparmeggiani "aaparmeggiani (2 commits)")[![penpendede](https://avatars.githubusercontent.com/u/9119675?v=4)](https://github.com/penpendede "penpendede (2 commits)")[![ischas](https://avatars.githubusercontent.com/u/8558126?v=4)](https://github.com/ischas "ischas (1 commits)")[![audionerd](https://avatars.githubusercontent.com/u/23459?v=4)](https://github.com/audionerd "audionerd (1 commits)")[![szeist](https://avatars.githubusercontent.com/u/3885905?v=4)](https://github.com/szeist "szeist (1 commits)")

---

Tags

enable-corsphpphp-cross-domainphp-proxy

### Embed Badge

![Health badge](/badges/softius-cors-proxy/health.svg)

```
[![Health](https://phpackages.com/badges/softius-cors-proxy/health.svg)](https://phpackages.com/packages/softius-cors-proxy)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
