OpenSource CLI-App to install and handle stuff related to Web-Server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
940 B

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <?php
  2. namespace App;
  3. use Jenssegers\Blade\Blade;
  4. /**
  5. * wrapper for blade
  6. *
  7. *
  8. * @author Björn Hase, Tentakelfabrik
  9. * @license http://opensource.org/licenses/MIT The MIT License
  10. * @link https://gitea.tentakelfabrik.de/Tentakelfabrik/mcp
  11. *
  12. */
  13. class BladeFile
  14. {
  15. // cache dir
  16. const CACHE_DIR = '/storage/cache';
  17. // blade engine
  18. private $blade;
  19. /**
  20. * create blade
  21. *
  22. *
  23. * @param {string} $templateDir
  24. *
  25. */
  26. public function __construct($templateDir)
  27. {
  28. $this->blade = new Blade(base_path().$templateDir, base_path().self::CACHE_DIR);
  29. }
  30. /**
  31. * put to file
  32. *
  33. * @param {string} $template
  34. * @param {string} $fullpath
  35. * @param {array} $data
  36. *
  37. */
  38. public function put($template, $fullpath, $data)
  39. {
  40. $content = $this->blade->render($template, $data);
  41. file_put_contents($fullpath, $content);
  42. }
  43. }