PHPackages                             tourze/json-rpc-check-ip-bundle - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. tourze/json-rpc-check-ip-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

tourze/json-rpc-check-ip-bundle
===============================

JsonRPC IP检查

0.0.3(6mo ago)027MITPHPCI passing

Since Apr 15Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/tourze/json-rpc-check-ip-bundle)[ Packagist](https://packagist.org/packages/tourze/json-rpc-check-ip-bundle)[ RSS](/packages/tourze-json-rpc-check-ip-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (18)Versions (4)Used By (0)

JsonRPC Check IP Bundle
=======================

[](#jsonrpc-check-ip-bundle)

[English](README.md) | [中文](README.zh-CN.md)

[![Latest Version](https://camo.githubusercontent.com/15c34e2e00a107709d51947b4e8897e42d5780fb9b51d239ad033b94f1e73392/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f75727a652f6a736f6e2d7270632d636865636b2d69702d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/json-rpc-check-ip-bundle)[![Build Status](https://camo.githubusercontent.com/11abbdeb661bda32a405d6bc6c8a60de567c183af3286cf7ad97503a6de7e541/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f746f75727a652f6a736f6e2d7270632d636865636b2d69702d62756e646c652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/tourze/json-rpc-check-ip-bundle)[![Quality Score](https://camo.githubusercontent.com/ba7a440f70719acb5e420fc45bd59af3e5ecd3e6c031cde92881c302cb13d2f4/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f746f75727a652f6a736f6e2d7270632d636865636b2d69702d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/tourze/json-rpc-check-ip-bundle)[![Total Downloads](https://camo.githubusercontent.com/0302ab0b548c0ce025a4f7fd5cfa7e4be817ffd68f145d1be06ef4be7cde1853/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f75727a652f6a736f6e2d7270632d636865636b2d69702d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/json-rpc-check-ip-bundle)[![PHP Version Require](https://camo.githubusercontent.com/d521b8c87087c5f49a116b8b0805ad892942cf81cd945795ec961a49d13ce6c7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f746f75727a652f6a736f6e2d7270632d636865636b2d69702d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/json-rpc-check-ip-bundle)[![License](https://camo.githubusercontent.com/32ff292bacfdcd93ac9016e55dbca48edf0e708a097bf3edcefcd05a8ceb7ea6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f75727a652f6a736f6e2d7270632d636865636b2d69702d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/json-rpc-check-ip-bundle)[![Coverage Status](https://camo.githubusercontent.com/c97b00c48bd2ca1aa95a4696d432c77f41053bf807938d5511ba611f1481e934/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f746f75727a652f6a736f6e2d7270632d636865636b2d69702d62756e646c652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/github/tourze/json-rpc-check-ip-bundle?branch=master)

A Symfony bundle that provides IP-based access control for JsonRPC server-to-server interfaces. By annotating your service classes with the `CheckIp` attribute, you can restrict access to specific IP ranges using environment variables.

Features
--------

[](#features)

- **IP-based access control**: Restrict JsonRPC method access by client IP address
- **Attribute-based configuration**: Simple `#[CheckIp]` annotation on service classes
- **Environment variable driven**: Configure allowed IPs via environment variables
- **CIDR support**: Supports both individual IPs and CIDR notation (e.g., `192.168.1.0/24`)
- **Symfony integration**: Seamlessly integrates with Symfony's RequestStack and IpUtils
- **Graceful defaults**: If no IPs are configured, all requests are allowed by default

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

[](#installation)

```
composer require tourze/json-rpc-check-ip-bundle
```

Quick Start
-----------

[](#quick-start)

1. **Configure allowed IPs** in your environment variables (e.g., `.env`):

```
# Allow specific IPs and CIDR ranges
ALLOWED_RPC_IPS=127.0.0.1,192.168.1.0/24,10.0.0.100
```

2. **Annotate your JsonRPC service class** with the `CheckIp` attribute:

```
