• Stars
    star
    660
  • Rank 68,297 (Top 2 %)
  • Language
    PHP
  • Created over 7 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

📣 A fast reverse proxy written in PHP that helps to expose local services to the internet

Software License Build Status Coverage Status Latest Stable Version Scrutinizer

Spike is a fast reverse proxy built on top of ReactPHP that helps to expose your local services to the internet.

简体中文

Installation

Install via composer

composer global require slince/spike

Both the server and local machine need to install this.

Schematic diagram

Configure the server

A public machine that can be accessed on the internet is needed. Assuming already. There are two ways to start the server

Based on defaults

Use the following command to start the server

$ spiked --address=127.0.0.1:8088

The above command can create a basic service. If you want to customize more information, you should start the server based on the configuration file.

Based on the configuration file.

  • Creates a configuration file

Execute the following command to create it.

$ spiked init --dir=/home/conf --format=json

Yaml,Xml,Ini and Json(default) files are supported. Use the following command for help.

$ spiked init -h
  • Open the configuration file and modify the parameters.

  • Executes the following command to start the service.

 $ spiked --config=/home/conf/spiked.json

Configure the client.

You should first create a configuration file for the client.

  • Execute the following command to create it
$ spike init --dir=/home/conf --format=json

Use the following command for help about this command

$ spike init -h
  • Open the configuration file and modify the parameters.

  • Start the client service.

$ spike --config=/home/conf/spike.json

Tunnel

The definition of the tunnel only in the client, the server does not need to do any configuration, so as to achieve the most simplified configuration.

Now supports both http and tcp tunnels

Open the configuration file for the client and modify the parameters for "tunnel".

  • Add an HTTP tunnel
{
    "protocol": "http",
    "serverPort": 8086,
    "proxyHosts": {
        "www.foo.com": "127.0.0.1:80",
        "www.bar.com": "192.168.1.101:8080"
    }
}

Restarts the client service. Visit "http://www.foo.com:8086", the service will be forwarded to the local "127.0.0.1:80"; Note that resolve "www.foo.com" to the server IP.

  • Add a TCP tunnel

The services based on the tcp can use the tunnel, such as: mysql, redis, ssh and so on; The following is an example of proxy mysql service

{
    "protocol": "tcp",
    "serverPort": 8087,
    "host": "127.0.0.1:3306"
}

Execute the following command to visit the local mysql service.

$ mysql -h SERVER IP -P 8087

Client authentication

The authentication is not enabled on the server based on defaults.You should start the server based on configuration file, if you want to enable this.

  • Enable authentication

Open the configuration file for the server and modify parameters for "auth" and restart the service.

Currently only supports a simple user name password authentication, more authentication methods will be added later.

  • Modify the client identity information

Open the configuration file for the client and modify parameters for "auth". Keep the same parameters as the server.

Configure log

The default to open the console and file two forms of the log; the first will print the logs to the console; the second will write all the logs to the specified file; Default log level is "info"; You can adjust this in the configuration file.

List Commands

$ spike list
   _____   _____   _   _   _    _____
  /  ___/ |  _  \ | | | | / /  | ____|
  | |___  | |_| | | | | |/ /   | |__
  \___  \ |  ___/ | | | |\ \   |  __|
   ___| | | |     | | | | \ \  | |___
  /_____/ |_|     |_| |_|  \_\ |_____|
  
  Spike Client 0.0.1
  
  Usage:
    command [options] [arguments]
  
  Options:
    -h, --help            Display this help message
    -q, --quiet           Do not output any message
    -V, --version         Display this application version
        --ansi            Force ANSI output
        --no-ansi         Disable ANSI output
    -n, --no-interaction  Do not ask any interactive question
    -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
  
  Available commands:
    help        Displays help for a command
    init        Create a configuration file in the specified directory
    list        Lists commands
    list-proxy  Lists all supported proxy hosts by the client

Changelog

See CHANGELOG.md

License

The MIT license. See MIT

More Repositories

1

composer-registry-manager

🛠️ 🔨 Composer registry manager that help to easily switch to the composer repository you want.
PHP
533
star
2

shopify-api-php

🚀 Shopify API Client for PHP
PHP
127
star
3

smartqq

🐧 SmartQQ (原 WebQQ ) API 的 PHP 语言实现,提供了一系列更优雅可读性更高的API
PHP
82
star
4

youzan-pay

基于有赞云和有赞微小店实现个人收款解决方案。
PHP
69
star
5

China

🇨🇳 一个轻巧的中国的地区、民族以及节假日信息的查询PHP库
PHP
55
star
6

shipment-tracking

✨ A flexible shipment tracking library for multi carriers like DHL eCommerce, USPS, YanWen Express, Epacket, E包裹, E特快, 国际EMS, 快递100,递四方 etc.
PHP
26
star
7

process

🐋 The process wrapper and manager based on PCNTL on the Unix-like systems using php
PHP
22
star
8

di

🐑 A flexible dependency injection container; It is an implementation of PSR-11
PHP
20
star
9

social-share.js

🎉 一个可以帮助快速创建社交网站分享按钮的轻巧的 JavaScript 组件
JavaScript
18
star
10

spike-go

📣 A fast reverse proxy written in golang that helps to expose local services to the internet
Go
17
star
11

sql-to-markdown

Convert mysql table schema to markdown table.
PHP
16
star
12

middleware

🐳 A PSR15 middleware dispatcher
PHP
15
star
13

expression-language.js

🌴 An engine that can compile and evaluate expressions written in typescript
TypeScript
10
star
14

event-dispatcher

🔥 A flexible event dispatching library for PHP
PHP
9
star
15

tree-samples

PHP遍历二叉树的实现,深度优先,广度优先,非递归实现;
PHP
9
star
16

cakephp-permission

🍰 The role-based permissions management for CakePHP 3 🥞
PHP
9
star
17

spider

爬虫组件
PHP
8
star
18

config

🎍 A flexible configuration file loader that supports multiple file formats
PHP
8
star
19

composer-alias

🎸 Composer Alias Plugin
PHP
7
star
20

framework

The Slince PHP framework
PHP
7
star
21

mechanic

基于PHP的自动化测试框架
PHP
6
star
22

routing

🐬 A flexible web routing component.
PHP
5
star
23

shipment-tracking-foundation

✨ A flexible and shipment tracking library for multi carriers
PHP
5
star
24

upload

Process file uploads with multiple and extensible validation rules.
PHP
4
star
25

cakephp-pjax

🥞 Pjax plugin for CakePHP
PHP
4
star
26

hello-vm

一个超级mini的栈式虚拟机
Java
2
star
27

cycle-bundle

Symfony Bundle for Cycle ORM and DBAL
PHP
2
star
28

switchery.js

Annother IOS 7 style switches for your checkboxes
JavaScript
2
star
29

fastserver

PHP
1
star
30

expression

一个富有语言表现力的表达式引擎 Java 实现
Java
1
star
31

golang-lesson

Go 语言练习
Go
1
star
32

dragbox

基于 Socket 的私有网盘系统
PHP
1
star