├── .gitignore ├── composer.json ├── license.md ├── readme.md └── src ├── Commands ├── ThemeDownloader.php └── themes │ ├── ClassimaxTheme.php │ ├── LandingPageTheme.php │ └── Theme.php └── ThemeDownloaderServiceProvider.php /.gitignore: -------------------------------------------------------------------------------- 1 | .idea -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laraveldaily/theme-downloader", 3 | "description": "Easy to use bootstrap theme downloader", 4 | "license": "MIT", 5 | "authors": [ 6 | { 7 | "name": "Faustas Butkus", 8 | "email": "faustas.butkus@gmail.com" 9 | }, 10 | { 11 | "name": "PovilasKorop", 12 | "email": "povilas@laraveldaily.com" 13 | } 14 | ], 15 | "version": "0.1.0", 16 | "require": { 17 | "php": ">=5.6.0", 18 | "guzzlehttp/guzzle": "^6.3" 19 | }, 20 | "autoload": { 21 | "psr-4": { 22 | "laraveldaily\\ThemeDownloader\\" : "src" 23 | } 24 | }, 25 | 26 | "extra": { 27 | "laravel": { 28 | "providers": [ 29 | "laraveldaily\\ThemeDownloader\\ThemeDownloaderServiceProvider" 30 | ] 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /license.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) Copyright (c) 2018 LaravelDaily 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | Package downloads one of your chosen themes into your `resources/views` folders, also adding `routes` if required by the theme. 2 | 3 | ## Package Requirements 4 | * Laravel `^5.5` 5 | 6 | ## Usage 7 | 1. Install the package via `composer require laraveldaily/theme-downloader`. 8 | 2. That's it: run command `php artisan theme:download --theme=[YOUR_THEME_NAME]` 9 | 3. You will see new files appear in `resources/views` and `routes` folder 10 | 11 | More in-depth article: [ThemeDownloader v0.1: apply Bootstrap theme with Artisan command](https://laraveldaily.com/themedownloader-v0-1-apply-bootstrap-theme-artisan-command/) 12 | 13 | Demo-video: [Need Opinion: Laravel Bootstrap Theme Downloader](https://www.youtube.com/watch?v=GxO9UlieDDg) 14 | 15 | - - - - - 16 | 17 | ## Currently supported themes 18 | 19 | 1. [Landing Page](https://startbootstrap.com/themes/landing-page/) (`--theme=landing-page`) 20 | 21 | ![Landing Page](https://laraveldaily.com/wp-content/uploads/2019/08/Screen-Shot-2019-08-03-at-8.02.05-AM.png) 22 | 23 | 2. [Classimax](https://themefisher.com/products/classimax-bootstrap-classified-responsive-theme/) (`--theme=classimax`) 24 | 25 | ![Classimax](https://i2.wp.com/themefisher.com/wp-content/uploads/edd/2017/10/classimax-big-thumbnail.png?w=861&ssl=1) 26 | 27 | ## License 28 | The MIT License (MIT). Please see [License File](license.md) for more information. 29 | 30 | --- 31 | 32 | ## More from our LaravelDaily Team 33 | 34 | - Check out our adminpanel generator [QuickAdminPanel](https://quickadminpanel.com) 35 | - Follow our [Twitter](https://twitter.com/dailylaravel) and [Blog](http://laraveldaily.com/blog) 36 | - Subscribe to our [newsletter with 20+ Laravel links every Thursday](http://laraveldaily.com/weekly-laravel-newsletter/) 37 | - Subscribe to our [YouTube channel Laravel Business](https://www.youtube.com/channel/UCTuplgOBi6tJIlesIboymGA) 38 | -------------------------------------------------------------------------------- /src/Commands/ThemeDownloader.php: -------------------------------------------------------------------------------- 1 | nameRefactoring(); 47 | 48 | switch ($this->theme_name){ 49 | 50 | case "landing-page": 51 | $this->landingPage(); 52 | break; 53 | case "classimax": 54 | $this->classimax(); 55 | break; 56 | 57 | default: 58 | $this->error("Theme doesn't exist or is unavailable for this package."); 59 | } 60 | } 61 | 62 | protected function landingPage(){ 63 | $theme = new LandingPageTheme(); 64 | if(!$theme->checkClientsAvailability()){ 65 | $this->error("Server error. Check your internet connection or retry later."); 66 | return; 67 | } 68 | 69 | $this->info("Downloading theme..."); 70 | 71 | $theme->download(); 72 | 73 | $this->info("Your main view file is in resources/views/landing-page/welcome.blade.php"); 74 | } 75 | 76 | protected function classimax(){ 77 | $theme = new ClassimaxTheme(); 78 | 79 | if(!$theme->checkClientsAvailability()){ 80 | $this->error("Server error. Check your internet connection or retry later."); 81 | return; 82 | } 83 | 84 | $this->info("Downloading theme..."); 85 | 86 | $theme->download(); 87 | 88 | $this->info("Theme files downloaded successfully!"); 89 | } 90 | 91 | protected function nameRefactoring() 92 | { 93 | $this->theme_name = $this->option('theme'); 94 | 95 | $this->theme_name = strtolower($this->theme_name); 96 | 97 | $this->theme_name = str_replace(" ", "-", $this->theme_name); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /src/Commands/themes/ClassimaxTheme.php: -------------------------------------------------------------------------------- 1 | theme_name = 'classimax'; 19 | $this->client = new Client(); 20 | } 21 | 22 | function download() 23 | { 24 | $this->createDirectories(); 25 | $this->getThemeFiles(); 26 | } 27 | 28 | protected function getThemeFiles(){ 29 | 30 | //vendor 31 | $this->getScripts(); 32 | $this->getImages(); 33 | $this->getStyles(); 34 | $this->getPlugins(); 35 | 36 | //views 37 | $this->getLayout(); 38 | $this->getPartials(); 39 | $this->getViews(); 40 | 41 | //routes 42 | $this->getRouteFile(); 43 | 44 | //controllers 45 | $this->getControllerFile(); 46 | } 47 | 48 | protected function getControllerFile() 49 | { 50 | $res = $this->client->request("GET", 'https://raw.githubusercontent.com/LaravelDaily/theme-downloader-themes/master/classimax/ClassimaxController.php'); 51 | file_put_contents(base_path('app/Http/Controllers/ClassimaxController.php'), $res->getBody()); 52 | } 53 | 54 | protected function getRouteFile() 55 | { 56 | $res = $this->client->request("GET", 'https://raw.githubusercontent.com/LaravelDaily/theme-downloader-themes/master/classimax/classimax.php'); 57 | file_put_contents(base_path('routes/classimax.php'), $res->getBody()); 58 | 59 | if(file_exists( $web_route = base_path('routes/web.php'))){ 60 | file_put_contents($web_route, "include 'classimax.php';", FILE_APPEND); 61 | } 62 | } 63 | 64 | protected function createDirectories() 65 | { 66 | //views 67 | $this->createDirectory(resource_path('views/' . $this->theme_name)); 68 | $this->createDirectory(resource_path('views/' . $this->theme_name . '/partials')); 69 | $this->createDirectory(resource_path('views/' . $this->theme_name . '/layouts')); 70 | $this->createDirectory(resource_path('views/' . $this->theme_name . '/partials/blog')); 71 | $this->createDirectory(resource_path('views/' . $this->theme_name . '/partials/category')); 72 | $this->createDirectory(resource_path('views/' . $this->theme_name . '/partials/single-item')); 73 | $this->createDirectory(resource_path('views/' . $this->theme_name . '/partials/welcome')); 74 | 75 | //vendor 76 | $this->createDirectory(public_path('vendor')); 77 | $this->createDirectory(public_path('vendor/' . $this->theme_name)); 78 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/css')); 79 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/images')); 80 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/images/blog')); 81 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/images/call-to-action')); 82 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/images/footer')); 83 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/images/home')); 84 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/images/products')); 85 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/images/user')); 86 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/js')); 87 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/plugins')); 88 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/plugins/bootstrap')); 89 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/plugins/fancybox')); 90 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/plugins/fancybox/images')); 91 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/plugins/font-awesome')); 92 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/plugins/font-awesome/css')); 93 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/plugins/font-awesome/fonts')); 94 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/plugins/jquery')); 95 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/plugins/raty')); 96 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/plugins/seiyria-bootstrap-slider')); 97 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/plugins/slick-carousel')); 98 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/plugins/slick-carousel/slick')); 99 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/plugins/slick-carousel/slick/fonts')); 100 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/plugins/smoothscroll')); 101 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/plugins/tether')); 102 | } 103 | 104 | protected function getScripts() 105 | { 106 | $res = $this->client->request("GET", 'https://raw.githubusercontent.com/LaravelDaily/theme-downloader-themes/master/classimax/vendor/js/scripts.js'); 107 | file_put_contents(public_path('vendor/classimax/js/scripts.js'), $res->getBody()); 108 | } 109 | 110 | protected function getPlugins() 111 | { 112 | //bootstrap/* 113 | $this->createPluginFile('bootstrap/bootstrap-grid.min.css'); 114 | $this->createPluginFile('bootstrap/bootstrap-reboot.min.css'); 115 | $this->createPluginFile('bootstrap/bootstrap.bundle.min.js'); 116 | $this->createPluginFile('bootstrap/bootstrap.min.css'); 117 | $this->createPluginFile('bootstrap/bootstrap.min.js'); 118 | $this->createPluginFile('bootstrap/popper.min.js'); 119 | 120 | //fancybox/* 121 | $this->createPluginFile('fancybox/jquery.fancybox.pack.css'); 122 | $this->createPluginFile('fancybox/jquery.fancybox.pack.js'); 123 | 124 | //fancybox/images/* 125 | $this->createPluginFile('fancybox/images/fancybox_loading.gif'); 126 | $this->createPluginFile('fancybox/images/fancybox_loading@2x.gif'); 127 | $this->createPluginFile('fancybox/images/fancybox_overlay.png'); 128 | $this->createPluginFile('fancybox/images/fancybox_sprite.png'); 129 | $this->createPluginFile('fancybox/images/fancybox_sprite@2x.png'); 130 | 131 | //font-awesome/css/* 132 | $this->createPluginFile('font-awesome/css/font-awesome.min.css'); 133 | 134 | //font-awesome/fonts/* 135 | $this->createPluginSpecificFile('font-awesome/fonts/FontAwesome.otf'); 136 | $this->createPluginSpecificFile('font-awesome/fonts/fontawesome-webfont.eot'); 137 | $this->createPluginSpecificFile('font-awesome/fonts/fontawesome-webfont.svg'); 138 | $this->createPluginSpecificFile('font-awesome/fonts/fontawesome-webfont.ttf'); 139 | $this->createPluginSpecificFile('font-awesome/fonts/fontawesome-webfont.woff'); 140 | $this->createPluginSpecificFile('font-awesome/fonts/fontawesome-webfont.woff2'); 141 | 142 | //jquery/* 143 | $this->createPluginFile('jquery/core.js'); 144 | $this->createPluginFile('jquery/jquery.min.js'); 145 | $this->createPluginFile('jquery/jquery.slim.min.js'); 146 | 147 | //raty/* 148 | $this->createPluginFile('raty/jquery.raty-fa.js'); 149 | 150 | //seiyria-bootstrap-slider/* 151 | $this->createPluginFile('seiyria-bootstrap-slider/bootstrap-slider.min.css'); 152 | $this->createPluginFile('seiyria-bootstrap-slider/bootstrap-slider.min.js'); 153 | 154 | //slick-carousel/slick/* 155 | $this->createPluginFile('slick-carousel/slick/ajax-loader.gif'); 156 | $this->createPluginFile('slick-carousel/slick/slick-theme.css'); 157 | $this->createPluginFile('slick-carousel/slick/slick.css'); 158 | $this->createPluginFile('slick-carousel/slick/slick.min.js'); 159 | 160 | //slick-carousel/slick/fonts/* 161 | $this->createPluginSpecificFile('slick-carousel/slick/fonts/slick.eot'); 162 | $this->createPluginSpecificFile('slick-carousel/slick/fonts/slick.svg'); 163 | $this->createPluginSpecificFile('slick-carousel/slick/fonts/slick.ttf'); 164 | $this->createPluginSpecificFile('slick-carousel/slick/fonts/slick.woff'); 165 | 166 | //smoothscroll/* 167 | $this->createPluginFile('smoothscroll/SmoothScroll.min.js'); 168 | 169 | //tether/* 170 | $this->createPluginFile('tether/tether-theme-arrows-dark.min.css'); 171 | $this->createPluginFile('tether/tether-theme-arrows.min.css'); 172 | $this->createPluginFile('tether/tether-theme-basic.min.css'); 173 | $this->createPluginFile('tether/tether.min.css'); 174 | $this->createPluginFile('tether/tether.min.js'); 175 | } 176 | 177 | protected function createPluginFile($file_path) 178 | { 179 | $res = $this->client->request('GET', "https://raw.githubusercontent.com/LaravelDaily/theme-downloader-themes/master/classimax/vendor/plugins/{$file_path}"); 180 | file_put_contents(public_path("vendor/classimax/plugins/{$file_path}"), $res->getBody()); 181 | } 182 | 183 | protected function createPluginSpecificFile($file_path) 184 | { 185 | $resource = fopen(public_path("vendor/classimax/plugins/{$file_path}"), 'w'); 186 | $this->client->request("GET", "https://raw.githubusercontent.com/LaravelDaily/theme-downloader-themes/master/classimax/vendor/plugins/{$file_path}", 187 | ['sink' => $resource]); 188 | } 189 | 190 | protected function getImages() 191 | { 192 | //images/* 193 | $this->createImage('logo-footer.png'); 194 | $this->createImage('logo.png'); 195 | $this->createImage('nav-toogle-icon.png'); 196 | 197 | 198 | //images/blog/* 199 | $this->createImage('blog/post-1.jpg'); 200 | $this->createImage('blog/post-2.jpg'); 201 | $this->createImage('blog/post-3.jpg'); 202 | $this->createImage('blog/post-4.jpg'); 203 | $this->createImage('blog/post-5.jpg'); 204 | $this->createImage('blog/video-icon.png'); 205 | 206 | //images/call-to-action/* 207 | $this->createImage('call-to-action/cta-background.jpg'); 208 | 209 | //images/footer/* 210 | $this->createImage('footer/phone-icon.png'); 211 | 212 | //images/home/* 213 | $this->createImage('home/hero.jpg'); 214 | 215 | //images/products/* 216 | $this->createImage('products/products-1.jpg'); 217 | $this->createImage('products/products-2.jpg'); 218 | $this->createImage('products/products-3.jpg'); 219 | $this->createImage('products/products-4.jpg'); 220 | 221 | //images/user/* 222 | $this->createImage('user/user-thumb.jpg'); 223 | } 224 | 225 | protected function createImage($file_path) 226 | { 227 | $res = $this->client->request('GET', "https://raw.githubusercontent.com/LaravelDaily/theme-downloader-themes/master/classimax/vendor/images/{$file_path}"); 228 | file_put_contents(public_path("vendor/classimax/images/{$file_path}"), $res->getBody()); 229 | } 230 | 231 | protected function getStyles() 232 | { 233 | $res = $this->client->request("GET", 'https://raw.githubusercontent.com/LaravelDaily/theme-downloader-themes/master/classimax/vendor/css/style.css'); 234 | file_put_contents(public_path('vendor/classimax/css/style.css'), $res->getBody()); 235 | } 236 | 237 | protected function getLayout() 238 | { 239 | $res = $this->client->request("GET", 'https://raw.githubusercontent.com/LaravelDaily/theme-downloader-themes/master/classimax/views/layouts/app.blade.php'); 240 | file_put_contents(resource_path('views/classimax/layouts/app.blade.php'), $res->getBody()); 241 | } 242 | 243 | protected function getPartials() 244 | { 245 | //partials/* 246 | $this->createPartial('footers.blade.php'); 247 | $this->createPartial('ie-scripts.blade.php'); 248 | $this->createPartial('links.blade.php'); 249 | $this->createPartial('navbar.blade.php'); 250 | $this->createPartial('scripts.blade.php'); 251 | $this->createPartial('search.blade.php'); 252 | 253 | //partials/blog/* 254 | $this->createPartial('blog/content.blade.php'); 255 | $this->createPartial('blog/title.blade.php'); 256 | 257 | //partials/category/* 258 | $this->createPartial('category/products.blade.php'); 259 | $this->createPartial('category/sidebar.blade.php'); 260 | 261 | //partials/single-item/* 262 | $this->createPartial('single-item/product-info.blade.php'); 263 | 264 | //partials/welcome/* 265 | $this->createPartial('welcome/all-category.blade.php'); 266 | $this->createPartial('welcome/hero-area.blade.php'); 267 | $this->createPartial('welcome/popular-deals.blade.php'); 268 | } 269 | 270 | protected function createPartial($file_path) 271 | { 272 | $res = $this->client->request('GET', "https://raw.githubusercontent.com/LaravelDaily/theme-downloader-themes/master/classimax/views/partials/{$file_path}"); 273 | file_put_contents(resource_path("views/classimax/partials/$file_path"), $res->getBody()); 274 | } 275 | 276 | protected function getViews() 277 | { 278 | //views/* 279 | $this->createView('blog.blade.php'); 280 | $this->createView('category.blade.php'); 281 | $this->createView('dashboard.blade.php'); 282 | $this->createView('single-blog.blade.php'); 283 | $this->createView('single-item.blade.php'); 284 | $this->createView('user-profile.blade.php'); 285 | $this->createView('welcome.blade.php'); 286 | } 287 | 288 | protected function createView($file_path) 289 | { 290 | $res = $this->client->request('GET', "https://raw.githubusercontent.com/LaravelDaily/theme-downloader-themes/master/classimax/views/{$file_path}"); 291 | file_put_contents(resource_path("views/classimax/$file_path"), $res->getBody()); 292 | } 293 | 294 | function checkClientsAvailability() 295 | { 296 | return $this->checkClient('https://raw.githubusercontent.com/LaravelDaily/theme-downloader-themes/master/classimax/classimax.php'); 297 | } 298 | 299 | } -------------------------------------------------------------------------------- /src/Commands/themes/LandingPageTheme.php: -------------------------------------------------------------------------------- 1 | theme_name = "landing-page"; 19 | 20 | $this->client = new Client(); 21 | } 22 | 23 | function download(){ 24 | $this->createDirectories(); 25 | $this->getThemeFiles(); 26 | } 27 | 28 | protected function createDirectories() 29 | { 30 | //views 31 | $this->createDirectory(resource_path('views/' . $this->theme_name)); 32 | $this->createDirectory(resource_path('views/' . $this->theme_name . '/partials')); 33 | 34 | //vendor 35 | $this->createDirectory(public_path('vendor')); 36 | $this->createDirectory(public_path('vendor/' . $this->theme_name)); 37 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/fonts')); 38 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/css')); 39 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/js')); 40 | $this->createDirectory(public_path('vendor/' . $this->theme_name . '/img')); 41 | } 42 | 43 | protected function getThemeFiles() 44 | { 45 | //fonts/* 46 | $this->createFontFile('Simple-Line-Icons.woff2'); 47 | $this->createFontFile("fontawesome-webfont.woff2"); 48 | 49 | //images/* 50 | $this->createImage("bg-masthead.jpg"); 51 | $this->createImage("bg-showcase-1.jpg"); 52 | $this->createImage("bg-showcase-2.jpg"); 53 | $this->createImage("bg-showcase-3.jpg"); 54 | $this->createImage("testimonials-1.jpg"); 55 | $this->createImage("testimonials-2.jpg"); 56 | $this->createImage("testimonials-3.jpg"); 57 | 58 | //styles/* 59 | $this->createStyle('bootstrap.min.css'); 60 | $this->createStyle('font-awesome.min.css'); 61 | $this->createStyle('landing-page.min.css'); 62 | $this->createStyle('simple-line-icons.css'); 63 | 64 | //scripts/* 65 | $this->createScript('bootstrap.bundle.min.js'); 66 | $this->createScript('jquery.min.js'); 67 | 68 | //views/* 69 | $this->createView('welcome.blade.php'); 70 | 71 | //views/partials/* 72 | $this->createPartial('call-to-action.blade.php'); 73 | $this->createPartial('footer.blade.php'); 74 | $this->createPartial( 'icons-grid.blade.php'); 75 | $this->createPartial('image-showcases.blade.php'); 76 | $this->createPartial('masthead.blade.php'); 77 | $this->createPartial('navigation.blade.php'); 78 | $this->createPartial('scripts.blade.php'); 79 | $this->createPartial( 'testimonials.blade.php'); 80 | } 81 | 82 | protected function createFontFile($file_name) 83 | { 84 | $resource = fopen(public_path("vendor/landing-page/fonts/{$file_name}"), 'w'); 85 | $this->client->request("GET", "https://raw.githubusercontent.com/LaravelDaily/theme-downloader-themes/master/landing-page/vendor/fonts/{$file_name}", 86 | ['sink' => $resource]); 87 | } 88 | 89 | protected function createImage($file_name) 90 | { 91 | $res = $this->client->request('GET', "https://raw.githubusercontent.com/LaravelDaily/theme-downloader-themes/master/landing-page/vendor/img/$file_name"); 92 | file_put_contents(public_path("vendor/landing-page/img/$file_name"), $res->getBody()); 93 | } 94 | 95 | protected function createStyle($file_name) 96 | { 97 | $res = $this->client->request('GET', "https://raw.githubusercontent.com/LaravelDaily/theme-downloader-themes/master/landing-page/vendor/css/$file_name"); 98 | file_put_contents(public_path("vendor/landing-page/css/$file_name"), $res->getBody()); 99 | } 100 | 101 | protected function createScript($file_name) 102 | { 103 | $res = $this->client->request('GET', "https://raw.githubusercontent.com/LaravelDaily/theme-downloader-themes/master/landing-page/vendor/js/$file_name"); 104 | file_put_contents(public_path("vendor/landing-page/js/$file_name"), $res->getBody()); 105 | } 106 | 107 | protected function createView($file_name) 108 | { 109 | $res = $this->client->request('GET', "https://raw.githubusercontent.com/LaravelDaily/theme-downloader-themes/master/landing-page/$file_name"); 110 | file_put_contents(resource_path("views/landing-page/$file_name"), $res->getBody()); 111 | } 112 | 113 | protected function createPartial($file_name) 114 | { 115 | $res = $this->client->request('GET', "https://raw.githubusercontent.com/LaravelDaily/theme-downloader-themes/master/landing-page/partials/$file_name"); 116 | file_put_contents(resource_path("views/landing-page/partials/$file_name"), $res->getBody()); 117 | } 118 | 119 | function checkClientsAvailability() 120 | { 121 | return $this->checkClient('https://raw.githubusercontent.com/LaravelDaily/theme-downloader-themes/master/landing-page/welcome.blade.php'); 122 | } 123 | 124 | } -------------------------------------------------------------------------------- /src/Commands/themes/Theme.php: -------------------------------------------------------------------------------- 1 | client = new Client(); 21 | $this->client->request('GET', $url); 22 | } 23 | catch (ClientException $e){ 24 | return false; 25 | } 26 | catch (RequestException $e){ 27 | return false; 28 | } 29 | catch(ConnectException $e){ 30 | return false; 31 | } 32 | 33 | return true; 34 | } 35 | } -------------------------------------------------------------------------------- /src/ThemeDownloaderServiceProvider.php: -------------------------------------------------------------------------------- 1 | commands([ 16 | ThemeDownloader::class 17 | ]); 18 | 19 | } 20 | 21 | } --------------------------------------------------------------------------------