Skip to content

Commit a29e55f

Browse files
committed
initial commit
0 parents  commit a29e55f

File tree

126 files changed

+24081
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+24081
-0
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Legacy-PHP-Example-Client
2+
=========================
3+
4+
This examples shows how to use the SnapSearch PHP Client for legacy PHP applications that do not use Composer.
5+
6+
The `index.php` is an example of what you would have inside your front controller. Then you just need a `lib` folder containing the SnapSearch client and the Symfony HTTP Foundation component. In this case the SnapSearch client has been modified to bootstrap both the itself and the Symfony component for autoloading.

index.php

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
require_once('lib/SnapSearch-Client-PHP/src/SnapSearchClientPHP/Bootstrap.php');
4+
\SnapSearchClientPHP\Bootstrap::register();
5+
6+
$client = new \SnapSearchClientPHP\Client('email', 'key');
7+
$detector = new \SnapSearchClientPHP\Detector;
8+
$interceptor = new \SnapSearchClientPHP\Interceptor($client, $detector);
9+
10+
// //exceptions should be ignored in production, but during development you can check it for validation errors
11+
try{
12+
13+
$response = $interceptor->intercept();
14+
15+
}catch(SnapSearchClientPHP\SnapSearchException $e){}
16+
17+
if($response){
18+
19+
header(' ', true, $response['status']); //as of PHP 5.4, you can use http_response_code($response['status']);
20+
21+
if(!empty($response['headers'])){
22+
foreach($response['headers'] as $header){
23+
if($header['name'] == 'Location'){
24+
header($header['name'] . ': ' . $header['value']);
25+
}
26+
}
27+
}
28+
29+
echo $response['html'];
30+
31+
}else{
32+
33+
?>
34+
35+
<p>HELLO!</p>
36+
37+
<?php
38+
}
39+
?>
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto
3+
4+
# Custom for Visual Studio
5+
*.cs diff=csharp
6+
*.sln merge=union
7+
*.csproj merge=union
8+
*.vbproj merge=union
9+
*.fsproj merge=union
10+
*.dbproj merge=union
11+
12+
# Standard to msysgit
13+
*.doc diff=astextplain
14+
*.DOC diff=astextplain
15+
*.docx diff=astextplain
16+
*.DOCX diff=astextplain
17+
*.dot diff=astextplain
18+
*.DOT diff=astextplain
19+
*.pdf diff=astextplain
20+
*.PDF diff=astextplain
21+
*.rtf diff=astextplain
22+
*.RTF diff=astextplain

lib/SnapSearch-Client-PHP/.gitignore

+229
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
#################
2+
## Custom
3+
#################
4+
5+
vendor/*
6+
bin/*
7+
build/*
8+
node_modules/*
9+
bower_components/*
10+
.c9revisions/*
11+
*.log
12+
*.pid
13+
composer.lock
14+
15+
#################
16+
## Eclipse
17+
#################
18+
19+
*.pydevproject
20+
.project
21+
.metadata
22+
bin/
23+
tmp/
24+
*.tmp
25+
*.bak
26+
*.swp
27+
*~.nib
28+
local.properties
29+
.classpath
30+
.settings/
31+
.loadpath
32+
33+
# External tool builders
34+
.externalToolBuilders/
35+
36+
# Locally stored "Eclipse launch configurations"
37+
*.launch
38+
39+
# CDT-specific
40+
.cproject
41+
42+
# PDT-specific
43+
.buildpath
44+
45+
46+
#################
47+
## Visual Studio
48+
#################
49+
50+
## Ignore Visual Studio temporary files, build results, and
51+
## files generated by popular Visual Studio add-ons.
52+
53+
# User-specific files
54+
*.suo
55+
*.user
56+
*.sln.docstates
57+
58+
# Build results
59+
60+
[Dd]ebug/
61+
[Rr]elease/
62+
x64/
63+
build/
64+
[Bb]in/
65+
[Oo]bj/
66+
67+
# MSTest test Results
68+
[Tt]est[Rr]esult*/
69+
[Bb]uild[Ll]og.*
70+
71+
*_i.c
72+
*_p.c
73+
*.ilk
74+
*.meta
75+
*.obj
76+
*.pch
77+
*.pdb
78+
*.pgc
79+
*.pgd
80+
*.rsp
81+
*.sbr
82+
*.tlb
83+
*.tli
84+
*.tlh
85+
*.tmp
86+
*.tmp_proj
87+
*.log
88+
*.vspscc
89+
*.vssscc
90+
.builds
91+
*.pidb
92+
*.log
93+
*.scc
94+
95+
# Visual C++ cache files
96+
ipch/
97+
*.aps
98+
*.ncb
99+
*.opensdf
100+
*.sdf
101+
*.cachefile
102+
103+
# Visual Studio profiler
104+
*.psess
105+
*.vsp
106+
*.vspx
107+
108+
# Guidance Automation Toolkit
109+
*.gpState
110+
111+
# ReSharper is a .NET coding add-in
112+
_ReSharper*/
113+
*.[Rr]e[Ss]harper
114+
115+
# TeamCity is a build add-in
116+
_TeamCity*
117+
118+
# DotCover is a Code Coverage Tool
119+
*.dotCover
120+
121+
# NCrunch
122+
*.ncrunch*
123+
.*crunch*.local.xml
124+
125+
# Installshield output folder
126+
[Ee]xpress/
127+
128+
# DocProject is a documentation generator add-in
129+
DocProject/buildhelp/
130+
DocProject/Help/*.HxT
131+
DocProject/Help/*.HxC
132+
DocProject/Help/*.hhc
133+
DocProject/Help/*.hhk
134+
DocProject/Help/*.hhp
135+
DocProject/Help/Html2
136+
DocProject/Help/html
137+
138+
# Click-Once directory
139+
publish/
140+
141+
# Publish Web Output
142+
*.Publish.xml
143+
*.pubxml
144+
145+
# NuGet Packages Directory
146+
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
147+
#packages/
148+
149+
# Windows Azure Build Output
150+
csx
151+
*.build.csdef
152+
153+
# Windows Store app package directory
154+
AppPackages/
155+
156+
# Others
157+
sql/
158+
*.Cache
159+
ClientBin/
160+
[Ss]tyle[Cc]op.*
161+
~$*
162+
*~
163+
*.dbmdl
164+
*.[Pp]ublish.xml
165+
*.pfx
166+
*.publishsettings
167+
168+
# RIA/Silverlight projects
169+
Generated_Code/
170+
171+
# Backup & report files from converting an old project file to a newer
172+
# Visual Studio version. Backup files are not needed, because we have git ;-)
173+
_UpgradeReport_Files/
174+
Backup*/
175+
UpgradeLog*.XML
176+
UpgradeLog*.htm
177+
178+
# SQL Server files
179+
App_Data/*.mdf
180+
App_Data/*.ldf
181+
182+
#############
183+
## Windows detritus
184+
#############
185+
186+
# Windows image file caches
187+
Thumbs.db
188+
ehthumbs.db
189+
190+
# Folder config file
191+
Desktop.ini
192+
193+
# Recycle Bin used on file shares
194+
$RECYCLE.BIN/
195+
196+
# Mac crap
197+
.DS_Store
198+
199+
200+
#############
201+
## Python
202+
#############
203+
204+
*.py[co]
205+
206+
# Packages
207+
*.egg
208+
*.egg-info
209+
dist/
210+
build/
211+
eggs/
212+
parts/
213+
var/
214+
sdist/
215+
develop-eggs/
216+
.installed.cfg
217+
218+
# Installer logs
219+
pip-log.txt
220+
221+
# Unit test / coverage reports
222+
.coverage
223+
.tox
224+
225+
#Translations
226+
*.mo
227+
228+
#Mr Developer
229+
.mr.developer.cfg

lib/SnapSearch-Client-PHP/.travis.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
language: php
2+
3+
php: [5.3, 5.4, 5.5, 5.6, hhvm]
4+
5+
matrix:
6+
fast_finish: true
7+
allow_failures:
8+
- php: hhvm
9+
10+
before_script:
11+
- composer self-update
12+
- composer install --dev
13+
14+
script: bin/codecept run
15+
16+
branches:
17+
only:
18+
- master

lib/SnapSearch-Client-PHP/LICENSE

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2013 SnapSearch
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)