Skip to content

Commit 5021bd3

Browse files
committed
First version
1 parent fd4cac9 commit 5021bd3

File tree

7 files changed

+3282
-5
lines changed

7 files changed

+3282
-5
lines changed

.gitignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/bootstrap/compiled.php
2-
.env.*.php
3-
.env.php
4-
.env
1+
/nbproject/
2+
/vendor/
3+
/tests/

README.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,55 @@
11
# laravel-elastic-sessions
2-
A session driver for elastic search for laravel 5.1
2+
An elastic-search based session driver for Laravel 5.1
3+
4+
##How to use
5+
1. Require it via composer
6+
```
7+
composer require itvisionsy/laravel-elastic-sessions
8+
```
9+
2. Add it to the providers list in `config/app.php`:
10+
```php
11+
'providers' => [
12+
//...
13+
ItvisionSy\LaravelElasticSessionDriver\ElasticSessionServiceProvider::class,
14+
//...
15+
]
16+
```
17+
3. Set the correct settings in `config/session.php`
18+
```php
19+
"driver" => "elastic",
20+
"elastic" => [
21+
"url" => "http://localhost:9200/",
22+
"index" => "laravel-es-sessions",
23+
"type" => "session"
24+
],
25+
```
26+
Values shown above are the default values in case you did not configure.
27+
28+
###Index/Type mapping
29+
Elastic will detect the mapping by default, however, it is recommended to set the mapping explicitly.
30+
31+
You can do so manually by applying this mapping to the index and type:
32+
```json
33+
{
34+
"index":"set_the_index",
35+
"type":"set_the_type",
36+
"body":{
37+
"properties":{
38+
"created":{"type":"date"},
39+
"updated":{"type":"date"},
40+
"data":{"type":"string","index":"no"}
41+
}
42+
}
43+
}
44+
```
45+
46+
Or simpler, the package can do it for you. You will need to tinker `./artisan tinker` and then set the mapping:
47+
```php
48+
\ItvisionSy\LaravelElasticSessionDriver\ElasticSessionStore::putMapping();
49+
```
50+
51+
## Author
52+
Muhannad Shelleh <muhannad.shelleh@live.com>
53+
54+
## License
55+
This code is published under [MIT](LICENSE) license.

composer.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "itvisionsy/laravel-elastic-session",
3+
"description": "A laravel 5.1 session driver on elasticsearch",
4+
"require": {
5+
"php": ">=5.5.0",
6+
"laravel/laravel": "5.1.*",
7+
"itvisionsy/php-es-orm": "1.4.*"
8+
},
9+
"require-dev": {
10+
"phpunit/phpunit": "^5.0@dev"
11+
},
12+
"license": "MIT",
13+
"authors": [
14+
{
15+
"name": "Muhannad Shelleh",
16+
"email": "muhannad.shelleh@itvision-sy.com"
17+
}
18+
],
19+
"minimum-stability": "stable",
20+
"autoload": {
21+
"psr-4": {
22+
"ItvisionSy\\LaravelElasticSessionDriver\\": "src"
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)