Skip to content

Commit 08ccf09

Browse files
committed
Added laravel example
1 parent efdffac commit 08ccf09

File tree

103 files changed

+27861
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+27861
-1
lines changed

Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
.PHONY: deploy
22
.PHONY: php php-composer
3-
.PHONY: php-lumen php-nette-tracy php-phalcon php-slim php-symfony-microservice php-wordpress
3+
.PHONY: php-laravel php-lumen php-nette-tracy php-phalcon php-slim php-symfony-microservice php-wordpress
44

55
deploy:
66
cd ${PROJECT} && now -c -n ${PROJECT} -S xorg ${NOW}
77

88
deploy-all:
99
$(MAKE) php
1010
$(MAKE) php-composer
11+
$(MAKE) php-laravel
1112
$(MAKE) php-lumen
1213
$(MAKE) php-nette-tracy
1314
$(MAKE) php-phalcon
@@ -46,3 +47,6 @@ php-symfony-microservice:
4647

4748
php-wordpress:
4849
PROJECT=php-wordpress $(MAKE) deploy
50+
51+
php-laravel:
52+
PROJECT=php-laravel $(MAKE) deploy

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Fastest way how to deploy example project is using following deploy button. It d
2828
|-------------|-------------|------|--------|
2929
| [PHP](/php) | Static frontend with PHP function. | [👀🕶](https://php.vercel.app) | [▲▲▲](https://vercel.com/new/project?template=https://github.com/juicyfx/vercel-examples/tree/master/php) |
3030
| [PHP - Composer](/php-compose) | Install dependencies using Composer | [👀🕶](https://php-composer-demo.vercel.app) | [▲▲▲](https://vercel.com/new/project?template=https://github.com/juicyfx/vercel-examples/tree/master/php-composer) |
31+
| [PHP - Laravel](/php-laravel) | Laravel - The PHP Framework For Web Artisans | [👀🕶](https://php-laravel.vercel.app) | [▲▲▲](https://vercel.com/new/project?template=https://github.com/juicyfx/vercel-examples/tree/master/php-laravel) |
3132
| [PHP - Lumen](/php-lumen) | Lumen - PHP Micro-Framework By Laravel | [👀🕶](https://php-lumen.vercel.app) | [▲▲▲](https://vercel.com/new/project?template=https://github.com/juicyfx/vercel-examples/tree/master/php-lumen) |
3233
| [PHP - Nette Tracy](/php-nette-tracy) | Tracy Debugging Tools by Nette. | [👀🕶](https://php-nette-tracy.vercel.app) | [▲▲▲](https://vercel.com/new/project?template=https://github.com/juicyfx/vercel-examples/tree/master/php-nette-tracy) |
3334
| [PHP - Phalcon](/php-phalcon) | Phalcon Framework: High Performance PHP Framework | [👀🕶](https://php-phalcon.vercel.app) | [▲▲▲](https://vercel.com/new/project?template=https://github.com/juicyfx/vercel-examples/tree/master/php-phalcon) |

php-laravel/.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2

php-laravel/.env.example

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
APP_NAME=Laravel
2+
APP_ENV=local
3+
APP_KEY=
4+
APP_DEBUG=true
5+
APP_URL=http://localhost
6+
7+
LOG_CHANNEL=stack
8+
9+
DB_CONNECTION=mysql
10+
DB_HOST=127.0.0.1
11+
DB_PORT=3306
12+
DB_DATABASE=laravel
13+
DB_USERNAME=root
14+
DB_PASSWORD=
15+
16+
BROADCAST_DRIVER=log
17+
CACHE_DRIVER=file
18+
QUEUE_CONNECTION=sync
19+
SESSION_DRIVER=file
20+
SESSION_LIFETIME=120
21+
22+
REDIS_HOST=127.0.0.1
23+
REDIS_PASSWORD=null
24+
REDIS_PORT=6379
25+
26+
MAIL_MAILER=smtp
27+
MAIL_HOST=smtp.mailtrap.io
28+
MAIL_PORT=2525
29+
MAIL_USERNAME=null
30+
MAIL_PASSWORD=null
31+
MAIL_ENCRYPTION=null
32+
MAIL_FROM_ADDRESS=null
33+
MAIL_FROM_NAME="${APP_NAME}"
34+
35+
AWS_ACCESS_KEY_ID=
36+
AWS_SECRET_ACCESS_KEY=
37+
AWS_DEFAULT_REGION=us-east-1
38+
AWS_BUCKET=
39+
40+
PUSHER_APP_ID=
41+
PUSHER_APP_KEY=
42+
PUSHER_APP_SECRET=
43+
PUSHER_APP_CLUSTER=mt1
44+
45+
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
46+
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
47+
48+
NODE_PATH=node

php-laravel/.gitattributes

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
* text=auto
2+
*.css linguist-vendored
3+
*.scss linguist-vendored
4+
*.js linguist-vendored
5+
CHANGELOG.md export-ignore

php-laravel/.gitignore

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/node_modules
2+
/public/hot
3+
/public/storage
4+
/storage/*.key
5+
/vendor
6+
.env
7+
.env.backup
8+
.phpunit.result.cache
9+
Homestead.json
10+
Homestead.yaml
11+
npm-debug.log
12+
yarn-error.log
13+
14+
.vercel

php-laravel/.nowignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/vendor
2+
/.idea
3+
Homestead.json
4+
Homestead.yaml

php-laravel/.styleci.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
php:
2+
preset: laravel
3+
disabled:
4+
- unused_use
5+
finder:
6+
not-name:
7+
- index.php
8+
- server.php
9+
js:
10+
finder:
11+
not-name:
12+
- webpack.mix.js
13+
css: true

php-laravel/api/index.php

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
/**
3+
* Here is the serverless function entry
4+
* for deployment with Vercel.
5+
*/
6+
require __DIR__.'/../public/index.php';

php-laravel/app/Article.php

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace App;
4+
5+
use Illuminate\Database\Eloquent\Model;
6+
use Phased\State\Traits\Vuexable;
7+
8+
class Article extends Model
9+
{
10+
use Vuexable;
11+
}

php-laravel/app/Console/Kernel.php

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
namespace App\Console;
4+
5+
use Illuminate\Console\Scheduling\Schedule;
6+
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
7+
8+
class Kernel extends ConsoleKernel
9+
{
10+
/**
11+
* The Artisan commands provided by your application.
12+
*
13+
* @var array
14+
*/
15+
protected $commands = [
16+
//
17+
];
18+
19+
/**
20+
* Define the application's command schedule.
21+
*
22+
* @param \Illuminate\Console\Scheduling\Schedule $schedule
23+
* @return void
24+
*/
25+
protected function schedule(Schedule $schedule)
26+
{
27+
// $schedule->command('inspire')->hourly();
28+
}
29+
30+
/**
31+
* Register the commands for the application.
32+
*
33+
* @return void
34+
*/
35+
protected function commands()
36+
{
37+
$this->load(__DIR__.'/Commands');
38+
39+
require base_path('routes/console.php');
40+
}
41+
}
+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
3+
namespace App\Exceptions;
4+
5+
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
6+
use Throwable;
7+
8+
class Handler extends ExceptionHandler
9+
{
10+
/**
11+
* A list of the exception types that are not reported.
12+
*
13+
* @var array
14+
*/
15+
protected $dontReport = [
16+
//
17+
];
18+
19+
/**
20+
* A list of the inputs that are never flashed for validation exceptions.
21+
*
22+
* @var array
23+
*/
24+
protected $dontFlash = [
25+
'password',
26+
'password_confirmation',
27+
];
28+
29+
/**
30+
* Report or log an exception.
31+
*
32+
* @param \Throwable $exception
33+
* @return void
34+
*
35+
* @throws \Exception
36+
*/
37+
public function report(Throwable $exception)
38+
{
39+
parent::report($exception);
40+
}
41+
42+
/**
43+
* Render an exception into an HTTP response.
44+
*
45+
* @param \Illuminate\Http\Request $request
46+
* @param \Throwable $exception
47+
* @return \Symfony\Component\HttpFoundation\Response
48+
*
49+
* @throws \Throwable
50+
*/
51+
public function render($request, Throwable $exception)
52+
{
53+
return parent::render($request, $exception);
54+
}
55+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use App\Article;
6+
use Illuminate\Http\Request;
7+
use Phased\Routing\Facades\Phase;
8+
use Phased\State\Facades\Vuex;
9+
10+
class BlogController extends Controller
11+
{
12+
public function HomePage()
13+
{
14+
// Pull the fake articles from our fake helper
15+
// generator
16+
$fakeArticles = $this->getFakerArticles();
17+
18+
// Add them to our vuex store
19+
// $store.state.articles.recent
20+
$fakeArticles->toVuex('articles', 'recents');
21+
22+
// return the Phase view
23+
return Phase::view();
24+
}
25+
26+
public function SingleArticle($article)
27+
{
28+
// Find the article that matches the slug
29+
// With real database models we would use Route Model binding
30+
// but since this is all just fake data, we will just match
31+
// the slug string here
32+
$fakeArticle = $this->getFakerArticles()->firstWhere('slug', $article);
33+
34+
// Set it as the active article
35+
// $store.state.articles.active
36+
$fakeArticle->toVuex('articles', 'active');
37+
38+
// return the Phase view
39+
return Phase::view();
40+
}
41+
42+
public function AboutPage()
43+
{
44+
$faker = \Faker\Factory::create();
45+
$faker->seed(1234);
46+
Vuex::state([
47+
'bio' => $faker->paragraphs(3, false)
48+
]);
49+
50+
return Phase::view();
51+
}
52+
53+
public function ContactPage()
54+
{
55+
$faker = \Faker\Factory::create();
56+
$faker->seed(4321);
57+
Vuex::state([
58+
'contact' => $faker->paragraphs(3, false)
59+
]);
60+
61+
return Phase::view();
62+
}
63+
/**
64+
* not a view
65+
*/
66+
private function getFakerArticles()
67+
{
68+
// Generate a collection of fake blog articles...
69+
// Our faker has a common seed, so this will always
70+
// generate the same articles
71+
return factory(Article::class, 10)->make();
72+
}
73+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
6+
use Illuminate\Foundation\Bus\DispatchesJobs;
7+
use Illuminate\Foundation\Validation\ValidatesRequests;
8+
use Illuminate\Routing\Controller as BaseController;
9+
10+
class Controller extends BaseController
11+
{
12+
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
13+
}

0 commit comments

Comments
 (0)