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.

45 lines
742 B

4 years ago
  1. <?php
  2. namespace App;
  3. use Jenssegers\Blade\Blade;
  4. /**
  5. *
  6. *
  7. *
  8. *
  9. */
  10. class BladeFile
  11. {
  12. // cache dir
  13. const CACHE_DIR = '/storage/cache';
  14. // blade engine
  15. private $blade;
  16. /**
  17. *
  18. *
  19. *
  20. * @param {string} $templateDir
  21. *
  22. */
  23. public function __construct($templateDir)
  24. {
  25. $this->blade = new Blade(base_path().$templateDir, base_path().self::CACHE_DIR);
  26. }
  27. /**
  28. * put to file
  29. *
  30. * @param {string} $template
  31. * @param {string} $fullpath
  32. * @param {array} $data
  33. *
  34. */
  35. public function put($template, $fullpath, $data)
  36. {
  37. $content = $this->blade->render($template, $data);
  38. file_put_contents($fullpath, $content);
  39. }
  40. }