Skip to content

Commit 7f6f55e

Browse files
author
James Wigger
committed
added faker package to development libraries for mocking up content
1 parent 2025e3c commit 7f6f55e

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,8 @@
2121
"files": [
2222
"helpers.php"
2323
]
24+
},
25+
"require-dev": {
26+
"fzaninotto/faker": "^1.6"
2427
}
2528
}

helpers.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,18 @@ function base_layout_has($key)
142142
return false;
143143
}
144144
}
145+
146+
/**
147+
* Returns a new faker instance for mocking content
148+
*
149+
* @return Faker\Generator
150+
*/
151+
if(!function_exists('base_faker_factory')) {
152+
function base_faker_factory() {
153+
if(!class_exists('Faker\Factory')) {
154+
throw new Exception('Faker library is not installed - are you running in production?');
155+
}
156+
157+
return Faker\Factory::create();
158+
}
159+
}

0 commit comments

Comments
 (0)