From 59faec1157b59df7a884e995da2a0a71e5a4f987 Mon Sep 17 00:00:00 2001 From: Hubert Nguyen Date: Fri, 15 Sep 2023 09:31:41 -0700 Subject: [PATCH 01/11] Make this a starter project for Laravel 10 This branch was copied from 'master' - removed the migrations we created for the tutorial - removed MongoDB from \src\composer.json - removed all the tutorial API routes This is not exactly a fresh Laravel 10 project, but it's close enough for the users to get going and start learning about MongoDB from here --- src/composer.json | 1 - .../2023_07_19_225321_create_posts_table.php | 31 --- ...3_202445_create_customer_s_q_l_s_table.php | 36 --- ..._051124_create_customer_mongo_db_table.php | 30 --- src/routes/api.php | 243 +----------------- 5 files changed, 1 insertion(+), 340 deletions(-) delete mode 100644 src/database/migrations/2023_07_19_225321_create_posts_table.php delete mode 100644 src/database/migrations/2023_08_03_202445_create_customer_s_q_l_s_table.php delete mode 100644 src/database/migrations/2023_08_09_051124_create_customer_mongo_db_table.php diff --git a/src/composer.json b/src/composer.json index 6ddb80c..a41d46f 100644 --- a/src/composer.json +++ b/src/composer.json @@ -7,7 +7,6 @@ "require": { "php": "^8.1", "guzzlehttp/guzzle": "^7.2", - "mongodb/laravel-mongodb": "4.0.0-rc1", "laravel/framework": "^10.0", "laravel/sanctum": "^3.3", "laravel/tinker": "^2.8" diff --git a/src/database/migrations/2023_07_19_225321_create_posts_table.php b/src/database/migrations/2023_07_19_225321_create_posts_table.php deleted file mode 100644 index 13ea466..0000000 --- a/src/database/migrations/2023_07_19_225321_create_posts_table.php +++ /dev/null @@ -1,31 +0,0 @@ -id(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('posts'); - } -}; diff --git a/src/database/migrations/2023_08_03_202445_create_customer_s_q_l_s_table.php b/src/database/migrations/2023_08_03_202445_create_customer_s_q_l_s_table.php deleted file mode 100644 index a6da3eb..0000000 --- a/src/database/migrations/2023_08_03_202445_create_customer_s_q_l_s_table.php +++ /dev/null @@ -1,36 +0,0 @@ -create('customer_sql', function (Blueprint $table) { - $table->id(); - $table->uuid('guid')->unique(); - $table->string('first_name'); - $table->string('family_name'); - $table->string('email'); - $table->text('address'); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('customer_s_q_l_s'); - } -}; diff --git a/src/database/migrations/2023_08_09_051124_create_customer_mongo_db_table.php b/src/database/migrations/2023_08_09_051124_create_customer_mongo_db_table.php deleted file mode 100644 index 88fa5bb..0000000 --- a/src/database/migrations/2023_08_09_051124_create_customer_mongo_db_table.php +++ /dev/null @@ -1,30 +0,0 @@ -create('laracoll', function ($collection) { - $collection->unique('guid'); // Ensure the guid is unique since it will be used as a primary key. - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('laracoll'); - } -}; diff --git a/src/routes/api.php b/src/routes/api.php index a78242a..c313c9f 100644 --- a/src/routes/api.php +++ b/src/routes/api.php @@ -4,12 +4,6 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Route; -// added to have access to Models\Post from within our API -use App\Models\CustomerMongoDB; -use App\Models\CustomerSQL; - -use MongoDB\Laravel\Document; - /* |-------------------------------------------------------------------------- | API Routes @@ -23,239 +17,4 @@ Route::middleware('auth:sanctum')->get('/user', function (Request $request) { return $request->user(); -}); - - -/* - Just a test -*/ -Route::get('/hello_world/', function (Request $request) { - return ['msg' => 'hello_world']; -}); - -/* - Send a ping to our MongoDB cluster to see if our connection settings are correct -*/ -Route::get('/test_mongodb/', function (Request $request) { - - $connection = DB::connection('mongodb'); - $msg = 'MongoDB is accessible!'; - try { - $connection->command(['ping' => 1]); - } catch (\Exception $e) { - $msg = 'MongoDB is not accessible. Error: ' . $e->getMessage(); - } - - return ['msg' => $msg]; -}); - -/* - Laravel check on the MySQL connection -*/ -Route::get('/test_mysql/', function (Request $request) { - try { - DB::connection()->getPdo(); - return ['status' => 'executed', 'data' => 'Successfully connected to the DB.' ]; - } catch (\Exception $e) { - return ['status' => 'FAIL. exception', 'data' => $e ]; - } -}); - -/* - Create a new "customer" in our SQL database - This is just to show the code looks identical to the MongoDB version -*/ -Route::get('/create_eloquent_sql/', function (Request $request) { - - try { - $success = CustomerSQL::create([ - 'guid' => 'cust_0000', - 'first_name' => 'John', - 'family_name' => 'Doe', - 'email' => 'j.doe@gmail.com', - 'address' => '123 my street, my city, zip, state, country' - ]); - $msg = "OK"; - } - catch (\Exception $e) { - $msg = 'Create user via Eloquent SQL model. Error: ' . $e->getMessage(); - } - - return ['status' => 'executed', 'msg' => $msg]; -}); - -/* - Create a new "customer" in our SQL database - This is just to show the code looks identical to the MongoDB version -*/ -Route::get('/create_eloquent_mongo/', function (Request $request) { - try { - $success = CustomerMongoDB::create([ - 'guid' => 'cust_1111', - 'first_name' => 'John', - 'family_name' => 'Doe', - 'email' => 'j.doe@gmail.com', - 'address' => '123 my street, my city, zip, state, country' - ]); - $msg = "OK"; - } - catch (\Exception $e) { - $msg = 'Create user via Eloquent MongoDB model. Error: ' . $e->getMessage(); - } - - return ['status' => 'executed', 'data' => $msg]; -}); - -/* - Find a record using Eloquent + MongoDB -*/ -Route::get('/find_eloquent/', function (Request $request) { - - $customer = CustomerMongoDB::where('guid', 'cust_1111')->get(); - - return ['status' => 'executed', 'data' => $customer]; -}); - -/* - Update a record using Eloquent + MongoDB -*/ -Route::get('/update_eloquent/', function (Request $request) { - $result = CustomerMongoDB::where('guid', 'cust_1111')->update( ['first_name' => 'Jimmy'] ); - - return ['status' => 'executed', 'data' => $result]; -}); - -/* - Delete a record using Eloquent + MongoDB -*/ -Route::get('/delete_eloquent/', function (Request $request) { - $result = CustomerMongoDB::where('guid', 'cust_1111')->delete(); - - return ['status' => 'executed', 'data' => $result]; -}); - -/* - Create a new record with nested data, using Eloquent -*/ -Route::get('/create_nested/', function (Request $request) { - $message = "executed"; - $success = null; - - $address = new stdClass; - $address->street = '123 my street name'; - $address->city = 'my city'; - $address->zip = '12345'; - - $emails = ['j.doe@gmail.com', 'j.doe@work.com']; - - try { - $customer = new CustomerMongoDB(); - $customer->guid = 'cust_2222'; - $customer->first_name = 'John'; - $customer->family_name = 'Doe'; - $customer->email = $emails; - $customer->address = $address; - $success = $customer->save(); // save() returns 1 or 0 - } - catch (\Exception $e) { - $message = $e->getMessage(); - } - - return ['status' => $message, 'data' => $success]; -}); - -/* - Find records using a native MongoDB Query - 1 - with Model->whereRaw() - 2 - with native Collection->findOne() - 3 - with native Collection->find() -*/ -Route::get('/find_native/', function (Request $request) { - - // a simple MongoDB query that looks for a customer based on the guid - $mongodbquery = ['guid' => 'cust_2222']; - - // Option #1 - //========== - // use Eloquent's whereRaw() function. This is the easiest way to stay close to the Laravel paradigm - // returns an "Illuminate\Database\Eloquent\Collection" Object - $results = CustomerMongoDB::whereRaw( $mongodbquery )->get(); - - // Option #2 & #3 - //========== - // use the native MongoDB driver Collection object. with it, you can use the native MongoDB Query API - // - $mdb_collection = DB::connection('mongodb')->getCollection('laracoll'); - - // find the first document that matches the query - $mdb_bsondoc = $mdb_collection->findOne( $mongodbquery ); // returns a "MongoDB\Model\BSONDocument" Object - - // if we want to convert the MongoDB Document to a Laravel Model, use the Model's newFromBuilder() method - $cust = new CustomerMongoDB(); - $one_doc = $cust->newFromBuilder((array) $mdb_bsondoc); - - // find all documents that matches the query - // Note: we're using find without any arguments, so ALL documents will be returned - $mdb_cursor = $mdb_collection->find( ); // returns a "MongoDB\Driver\Cursor" object - $cust_array = array(); - foreach ($mdb_cursor->toArray() as $bson) { - $cust_array[] = $cust->newFromBuilder( $bson ); - } - - return ['status' => 'executed', 'whereraw' => $results, 'document' => $one_doc, 'cursor_array' => $cust_array]; -}); - -/* - Update a record using a native MongoDB Query -*/ -Route::get('/update_native/', function (Request $request) { - $mdb_collection = DB::connection('mongodb')->getCollection('laracoll'); - - $match = ['guid' => 'cust_2222']; - $update = ['$set' => ['first_name' => 'Henry', 'address.street' => '777 new street name'] ]; - $result = $mdb_collection->updateOne($match, $update ); - - return ['status' => 'executed', 'matched_docs' => $result->getMatchedCount(), 'modified_docs' => $result->getModifiedCount()]; -}); - -/* - Find and delete the first record that matches the query -*/ -Route::get('/delete_native/', function (Request $request) { - $mdb_collection = DB::connection('mongodb')->getCollection('laracoll'); - - $match = ['guid' => 'cust_2222']; - $result = $mdb_collection->deleteOne( $match ); - - return ['status' => 'executed', 'deleted_docs' => $result->getDeletedCount() ]; -}); - -/* - Executes an aggregation pipeline -*/ -Route::get('/aggregate/', function (Request $request) { - - $mdb_collection = DB::connection('mongodb_mflix')->getCollection('movies'); - - $stage0 = ['$unwind' => ['path' => '$genres']]; - $stage1 = ['$group' => ['_id' => '$genres', 'averageGenreRating' => ['$avg' => '$imdb.rating']]]; - $stage2 = ['$sort' => ['averageGenreRating' => -1]]; - - $aggregation = [$stage0, $stage1, $stage2]; - - $mdb_cursor = $mdb_collection->aggregate( $aggregation ); - - return ['status' => 'executed', 'data' => $mdb_cursor->toArray() ]; -}); - -/* - Create an index with a primary key -*/ -Route::get('/create_index/', function (Request $request) { - - $indexKeys = ["guid" => 1]; - $indexOptions = ["unique" => true]; - $result = DB::connection('mongodb')->getCollection('laracoll')->createIndex($indexKeys, $indexOptions); - - return ['status' => 'executed', 'data' => $result ]; -}); +}); \ No newline at end of file From bee262e26ee261c594024cc41c2e6afa22c95fad Mon Sep 17 00:00:00 2001 From: Hubert Nguyen Date: Mon, 18 Sep 2023 10:38:08 -0700 Subject: [PATCH 02/11] Clean Laravel 10 starter project, no mongodb (yet) see README.md for details --- .devcontainer/.env | 2 +- .devcontainer/devcontainer.json | 2 +- {src => .framework/php/src}/.editorconfig | 0 {src => .framework/php/src}/.env.example | 0 {src => .framework/php/src}/.gitattributes | 3 +- {src => .framework/php/src}/.gitignore | 0 {src => .framework/php/src}/.styleci.yml | 0 .framework/php/src/README.md | 7 + .../php/src}/app/Console/Kernel.php | 9 +- .../php/src}/app/Exceptions/Handler.php | 15 +- .../src}/app/Http/Controllers/Controller.php | 3 +- .../php/src}/app/Http/Kernel.php | 15 +- .../src}/app/Http/Middleware/Authenticate.php | 10 +- .../app/Http/Middleware/EncryptCookies.php | 0 .../PreventRequestsDuringMaintenance.php | 0 .../Middleware/RedirectIfAuthenticated.php | 8 +- .../src}/app/Http/Middleware/TrimStrings.php | 0 .../src}/app/Http/Middleware/TrustHosts.php | 2 +- .../src}/app/Http/Middleware/TrustProxies.php | 0 .../app/Http/Middleware/ValidateSignature.php | 22 + .../app/Http/Middleware/VerifyCsrfToken.php | 0 .../php/src}/app/Models/User.php | 3 +- .../src}/app/Providers/AppServiceProvider.php | 8 +- .../app/Providers/AuthServiceProvider.php | 12 +- .../Providers/BroadcastServiceProvider.php | 4 +- .../app/Providers/EventServiceProvider.php | 14 +- .../app/Providers/RouteServiceProvider.php | 40 ++ {src => .framework/php/src}/artisan | 0 {src => .framework/php/src}/bootstrap/app.php | 0 .../php/src}/bootstrap/cache/.gitignore | 0 {src => .framework/php/src}/composer.json | 31 +- {src => .framework/php/src}/composer.lock | 492 ++++-------------- {src => .framework/php/src}/config/app.php | 57 +- {src => .framework/php/src}/config/auth.php | 8 +- .../php/src}/config/broadcasting.php | 6 +- {src => .framework/php/src}/config/cache.php | 9 +- {src => .framework/php/src}/config/cors.php | 0 .../php/src}/config/database.php | 25 +- .../php/src}/config/filesystems.php | 5 +- .../php/src}/config/hashing.php | 0 .../php/src}/config/logging.php | 14 +- {src => .framework/php/src}/config/mail.php | 12 +- {src => .framework/php/src}/config/queue.php | 16 + .../php/src}/config/sanctum.php | 4 +- .../php/src}/config/services.php | 1 + .../php/src}/config/session.php | 0 {src => .framework/php/src}/config/view.php | 0 .../php/src}/database/.gitignore | 0 .../src}/database/factories/UserFactory.php | 20 +- .../2014_10_12_000000_create_users_table.php | 8 +- ...000_create_password_reset_tokens_table.php | 14 +- ..._08_19_000000_create_failed_jobs_table.php | 8 +- ...01_create_personal_access_tokens_table.php | 9 +- .../src/database/seeders/DatabaseSeeder.php | 22 + .framework/php/src/package.json | 13 + {src => .framework/php/src}/phpunit.xml | 15 +- {src => .framework/php/src}/public/.htaccess | 0 .../php/src}/public/favicon.ico | 0 {src => .framework/php/src}/public/index.php | 3 - {src => .framework/php/src}/public/robots.txt | 0 .../php/src}/resources/css/app.css | 0 .framework/php/src/resources/js/app.js | 1 + .../php/src}/resources/js/bootstrap.js | 18 +- .../php/src/resources/views/welcome.blade.php | 140 +++++ {src => .framework/php/src}/routes/api.php | 7 +- .../php/src}/routes/channels.php | 0 .../php/src}/routes/console.php | 0 .framework/php/src/routes/web.php | 18 + .../php/src}/storage/app/.gitignore | 0 .../php/src}/storage/app/public/.gitignore | 0 .../php/src}/storage/framework/.gitignore | 0 .../src}/storage/framework/cache/.gitignore | 0 .../storage/framework/cache/data/.gitignore | 0 .../storage/framework/sessions/.gitignore | 0 .../src}/storage/framework/testing/.gitignore | 0 .../src}/storage/framework/views/.gitignore | 0 .../php/src}/storage/logs/.gitignore | 0 .../php/src}/tests/CreatesApplication.php | 5 +- .../php/src}/tests/Feature/ExampleTest.php | 6 +- .../php/src}/tests/TestCase.php | 0 .../php/src}/tests/Unit/ExampleTest.php | 4 +- .framework/php/src/vite.config.js | 11 + src/app/Http/Controllers/PostController.php | 20 - src/app/Models/Author.php | 11 - src/app/Models/Book.php | 22 - src/app/Models/CustomerMongoDB.php | 22 - src/app/Models/CustomerSQL.php | 22 - src/app/Models/Post.php | 30 -- src/app/Providers/RouteServiceProvider.php | 63 --- src/database/seeders/DatabaseSeeder.php | 19 - src/init_repo.sh | 18 - src/lang/en.json | 7 - src/lang/en/auth.php | 20 - src/lang/en/pagination.php | 19 - src/lang/en/passwords.php | 22 - src/lang/en/validation.php | 163 ------ src/package.json | 18 - src/resources/js/app.js | 1 - src/resources/views/post.blade.php | 39 -- src/resources/views/welcome.blade.php | 132 ----- src/routes/web.php | 34 -- src/webpack.mix.js | 17 - 102 files changed, 566 insertions(+), 1314 deletions(-) rename {src => .framework/php/src}/.editorconfig (100%) rename {src => .framework/php/src}/.env.example (100%) rename {src => .framework/php/src}/.gitattributes (75%) rename {src => .framework/php/src}/.gitignore (100%) rename {src => .framework/php/src}/.styleci.yml (100%) create mode 100644 .framework/php/src/README.md rename {src => .framework/php/src}/app/Console/Kernel.php (69%) rename {src => .framework/php/src}/app/Exceptions/Handler.php (61%) rename {src => .framework/php/src}/app/Http/Controllers/Controller.php (69%) rename {src => .framework/php/src}/app/Http/Kernel.php (81%) rename {src => .framework/php/src}/app/Http/Middleware/Authenticate.php (54%) rename {src => .framework/php/src}/app/Http/Middleware/EncryptCookies.php (100%) rename {src => .framework/php/src}/app/Http/Middleware/PreventRequestsDuringMaintenance.php (100%) rename {src => .framework/php/src}/app/Http/Middleware/RedirectIfAuthenticated.php (59%) rename {src => .framework/php/src}/app/Http/Middleware/TrimStrings.php (100%) rename {src => .framework/php/src}/app/Http/Middleware/TrustHosts.php (90%) rename {src => .framework/php/src}/app/Http/Middleware/TrustProxies.php (100%) create mode 100644 .framework/php/src/app/Http/Middleware/ValidateSignature.php rename {src => .framework/php/src}/app/Http/Middleware/VerifyCsrfToken.php (100%) rename {src => .framework/php/src}/app/Models/User.php (91%) rename {src => .framework/php/src}/app/Providers/AppServiceProvider.php (72%) rename {src => .framework/php/src}/app/Providers/AuthServiceProvider.php (61%) rename {src => .framework/php/src}/app/Providers/BroadcastServiceProvider.php (85%) rename {src => .framework/php/src}/app/Providers/EventServiceProvider.php (69%) create mode 100644 .framework/php/src/app/Providers/RouteServiceProvider.php rename {src => .framework/php/src}/artisan (100%) rename {src => .framework/php/src}/bootstrap/app.php (100%) rename {src => .framework/php/src}/bootstrap/cache/.gitignore (100%) rename {src => .framework/php/src}/composer.json (64%) rename {src => .framework/php/src}/composer.lock (95%) rename {src => .framework/php/src}/config/app.php (78%) rename {src => .framework/php/src}/config/auth.php (91%) rename {src => .framework/php/src}/config/broadcasting.php (85%) rename {src => .framework/php/src}/config/cache.php (90%) rename {src => .framework/php/src}/config/cors.php (100%) rename {src => .framework/php/src}/config/database.php (90%) rename {src => .framework/php/src}/config/filesystems.php (93%) rename {src => .framework/php/src}/config/hashing.php (100%) rename {src => .framework/php/src}/config/logging.php (86%) rename {src => .framework/php/src}/config/mail.php (91%) rename {src => .framework/php/src}/config/queue.php (84%) rename {src => .framework/php/src}/config/sanctum.php (96%) rename {src => .framework/php/src}/config/services.php (97%) rename {src => .framework/php/src}/config/session.php (100%) rename {src => .framework/php/src}/config/view.php (100%) rename {src => .framework/php/src}/database/.gitignore (100%) rename {src => .framework/php/src}/database/factories/UserFactory.php (60%) rename {src => .framework/php/src}/database/migrations/2014_10_12_000000_create_users_table.php (86%) rename src/database/migrations/2014_10_12_100000_create_password_resets_table.php => .framework/php/src/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php (59%) rename {src => .framework/php/src}/database/migrations/2019_08_19_000000_create_failed_jobs_table.php (86%) rename {src => .framework/php/src}/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php (85%) create mode 100644 .framework/php/src/database/seeders/DatabaseSeeder.php create mode 100644 .framework/php/src/package.json rename {src => .framework/php/src}/phpunit.xml (65%) rename {src => .framework/php/src}/public/.htaccess (100%) rename {src => .framework/php/src}/public/favicon.ico (100%) rename {src => .framework/php/src}/public/index.php (99%) rename {src => .framework/php/src}/public/robots.txt (100%) rename {src => .framework/php/src}/resources/css/app.css (100%) create mode 100644 .framework/php/src/resources/js/app.js rename {src => .framework/php/src}/resources/js/bootstrap.js (51%) create mode 100644 .framework/php/src/resources/views/welcome.blade.php rename {src => .framework/php/src}/routes/api.php (71%) rename {src => .framework/php/src}/routes/channels.php (100%) rename {src => .framework/php/src}/routes/console.php (100%) create mode 100644 .framework/php/src/routes/web.php rename {src => .framework/php/src}/storage/app/.gitignore (100%) rename {src => .framework/php/src}/storage/app/public/.gitignore (100%) rename {src => .framework/php/src}/storage/framework/.gitignore (100%) rename {src => .framework/php/src}/storage/framework/cache/.gitignore (100%) rename {src => .framework/php/src}/storage/framework/cache/data/.gitignore (100%) rename {src => .framework/php/src}/storage/framework/sessions/.gitignore (100%) rename {src => .framework/php/src}/storage/framework/testing/.gitignore (100%) rename {src => .framework/php/src}/storage/framework/views/.gitignore (100%) rename {src => .framework/php/src}/storage/logs/.gitignore (100%) rename {src => .framework/php/src}/tests/CreatesApplication.php (74%) rename {src => .framework/php/src}/tests/Feature/ExampleTest.php (76%) rename {src => .framework/php/src}/tests/TestCase.php (100%) rename {src => .framework/php/src}/tests/Unit/ExampleTest.php (72%) create mode 100644 .framework/php/src/vite.config.js delete mode 100644 src/app/Http/Controllers/PostController.php delete mode 100644 src/app/Models/Author.php delete mode 100644 src/app/Models/Book.php delete mode 100644 src/app/Models/CustomerMongoDB.php delete mode 100644 src/app/Models/CustomerSQL.php delete mode 100644 src/app/Models/Post.php delete mode 100644 src/app/Providers/RouteServiceProvider.php delete mode 100644 src/database/seeders/DatabaseSeeder.php delete mode 100644 src/init_repo.sh delete mode 100644 src/lang/en.json delete mode 100644 src/lang/en/auth.php delete mode 100644 src/lang/en/pagination.php delete mode 100644 src/lang/en/passwords.php delete mode 100644 src/lang/en/validation.php delete mode 100644 src/package.json delete mode 100644 src/resources/js/app.js delete mode 100644 src/resources/views/post.blade.php delete mode 100644 src/resources/views/welcome.blade.php delete mode 100644 src/routes/web.php delete mode 100644 src/webpack.mix.js diff --git a/.devcontainer/.env b/.devcontainer/.env index 4be31c2..4248e91 100644 --- a/.devcontainer/.env +++ b/.devcontainer/.env @@ -6,7 +6,7 @@ NGINX_CONTAINER_PORT=80 NGINX_HOST_CONFD_DIR=./.docker/nginx/conf.d NGINX_CONTAINER_CONFD_DIR=/etc/nginx/conf.d -PHP_WEBROOT_HOST_PATH=../src/ +PHP_WEBROOT_HOST_PATH=../.framework/php/src/ PHP_WEBROOT_CONTAINER_PATH=/var/www/htdoc NGINX_WEBROOT_HOST_PATH=../src/ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6911479..920ab7d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,5 +1,5 @@ { - "name": "laravel9-mongodb-tutorial", + "name": "laravel-mongodb-tutorial", // Mandatory definition for .devcontainer // diff --git a/src/.editorconfig b/.framework/php/src/.editorconfig similarity index 100% rename from src/.editorconfig rename to .framework/php/src/.editorconfig diff --git a/src/.env.example b/.framework/php/src/.env.example similarity index 100% rename from src/.env.example rename to .framework/php/src/.env.example diff --git a/src/.gitattributes b/.framework/php/src/.gitattributes similarity index 75% rename from src/.gitattributes rename to .framework/php/src/.gitattributes index 510d996..fcb21d3 100644 --- a/src/.gitattributes +++ b/.framework/php/src/.gitattributes @@ -1,4 +1,4 @@ -* text=auto +* text=auto eol=lf *.blade.php diff=html *.css diff=css @@ -8,3 +8,4 @@ /.github export-ignore CHANGELOG.md export-ignore +.styleci.yml export-ignore diff --git a/src/.gitignore b/.framework/php/src/.gitignore similarity index 100% rename from src/.gitignore rename to .framework/php/src/.gitignore diff --git a/src/.styleci.yml b/.framework/php/src/.styleci.yml similarity index 100% rename from src/.styleci.yml rename to .framework/php/src/.styleci.yml diff --git a/.framework/php/src/README.md b/.framework/php/src/README.md new file mode 100644 index 0000000..2ad159b --- /dev/null +++ b/.framework/php/src/README.md @@ -0,0 +1,7 @@ +## About this repository + +- A clean Laravel 10 project created with `composer create-project laravel/laravel` +- no extra package added yet +- designed to run in CodeSpaces or Docker via `\.devcontainer\` with `docker compuse up` +- directory structure friendly to Wilco via the `\.framework\` directory +- NGINX serves the public web folder located at `\.framework\php\src\public\` \ No newline at end of file diff --git a/src/app/Console/Kernel.php b/.framework/php/src/app/Console/Kernel.php similarity index 69% rename from src/app/Console/Kernel.php rename to .framework/php/src/app/Console/Kernel.php index d8bc1d2..e6b9960 100644 --- a/src/app/Console/Kernel.php +++ b/.framework/php/src/app/Console/Kernel.php @@ -9,21 +9,16 @@ class Kernel extends ConsoleKernel { /** * Define the application's command schedule. - * - * @param \Illuminate\Console\Scheduling\Schedule $schedule - * @return void */ - protected function schedule(Schedule $schedule) + protected function schedule(Schedule $schedule): void { // $schedule->command('inspire')->hourly(); } /** * Register the commands for the application. - * - * @return void */ - protected function commands() + protected function commands(): void { $this->load(__DIR__.'/Commands'); diff --git a/src/app/Exceptions/Handler.php b/.framework/php/src/app/Exceptions/Handler.php similarity index 61% rename from src/app/Exceptions/Handler.php rename to .framework/php/src/app/Exceptions/Handler.php index 8e7fbd1..56af264 100644 --- a/src/app/Exceptions/Handler.php +++ b/.framework/php/src/app/Exceptions/Handler.php @@ -8,16 +8,7 @@ class Handler extends ExceptionHandler { /** - * A list of the exception types that are not reported. - * - * @var array> - */ - protected $dontReport = [ - // - ]; - - /** - * A list of the inputs that are never flashed for validation exceptions. + * The list of the inputs that are never flashed to the session on validation exceptions. * * @var array */ @@ -29,10 +20,8 @@ class Handler extends ExceptionHandler /** * Register the exception handling callbacks for the application. - * - * @return void */ - public function register() + public function register(): void { $this->reportable(function (Throwable $e) { // diff --git a/src/app/Http/Controllers/Controller.php b/.framework/php/src/app/Http/Controllers/Controller.php similarity index 69% rename from src/app/Http/Controllers/Controller.php rename to .framework/php/src/app/Http/Controllers/Controller.php index a0a2a8a..77ec359 100644 --- a/src/app/Http/Controllers/Controller.php +++ b/.framework/php/src/app/Http/Controllers/Controller.php @@ -3,11 +3,10 @@ namespace App\Http\Controllers; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; -use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Routing\Controller as BaseController; class Controller extends BaseController { - use AuthorizesRequests, DispatchesJobs, ValidatesRequests; + use AuthorizesRequests, ValidatesRequests; } diff --git a/src/app/Http/Kernel.php b/.framework/php/src/app/Http/Kernel.php similarity index 81% rename from src/app/Http/Kernel.php rename to .framework/php/src/app/Http/Kernel.php index 5706f79..494c050 100644 --- a/src/app/Http/Kernel.php +++ b/.framework/php/src/app/Http/Kernel.php @@ -16,8 +16,8 @@ class Kernel extends HttpKernel protected $middleware = [ // \App\Http\Middleware\TrustHosts::class, \App\Http\Middleware\TrustProxies::class, - \App\Http\Middleware\PreventRequestsDuringMaintenance::class, \Illuminate\Http\Middleware\HandleCors::class, + \App\Http\Middleware\PreventRequestsDuringMaintenance::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \App\Http\Middleware\TrimStrings::class, \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, @@ -33,7 +33,6 @@ class Kernel extends HttpKernel \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, - // \Illuminate\Session\Middleware\AuthenticateSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, @@ -41,26 +40,28 @@ class Kernel extends HttpKernel 'api' => [ // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, - 'throttle:api', + \Illuminate\Routing\Middleware\ThrottleRequests::class.':api', \Illuminate\Routing\Middleware\SubstituteBindings::class, ], ]; /** - * The application's route middleware. + * The application's middleware aliases. * - * These middleware may be assigned to groups or used individually. + * Aliases may be used instead of class names to conveniently assign middleware to routes and groups. * * @var array */ - protected $routeMiddleware = [ + protected $middlewareAliases = [ 'auth' => \App\Http\Middleware\Authenticate::class, 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, + 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 'can' => \Illuminate\Auth\Middleware\Authorize::class, 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, - 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, + 'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class, + 'signed' => \App\Http\Middleware\ValidateSignature::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, ]; diff --git a/src/app/Http/Middleware/Authenticate.php b/.framework/php/src/app/Http/Middleware/Authenticate.php similarity index 54% rename from src/app/Http/Middleware/Authenticate.php rename to .framework/php/src/app/Http/Middleware/Authenticate.php index 704089a..d4ef644 100644 --- a/src/app/Http/Middleware/Authenticate.php +++ b/.framework/php/src/app/Http/Middleware/Authenticate.php @@ -3,19 +3,15 @@ namespace App\Http\Middleware; use Illuminate\Auth\Middleware\Authenticate as Middleware; +use Illuminate\Http\Request; class Authenticate extends Middleware { /** * Get the path the user should be redirected to when they are not authenticated. - * - * @param \Illuminate\Http\Request $request - * @return string|null */ - protected function redirectTo($request) + protected function redirectTo(Request $request): ?string { - if (! $request->expectsJson()) { - return route('login'); - } + return $request->expectsJson() ? null : route('login'); } } diff --git a/src/app/Http/Middleware/EncryptCookies.php b/.framework/php/src/app/Http/Middleware/EncryptCookies.php similarity index 100% rename from src/app/Http/Middleware/EncryptCookies.php rename to .framework/php/src/app/Http/Middleware/EncryptCookies.php diff --git a/src/app/Http/Middleware/PreventRequestsDuringMaintenance.php b/.framework/php/src/app/Http/Middleware/PreventRequestsDuringMaintenance.php similarity index 100% rename from src/app/Http/Middleware/PreventRequestsDuringMaintenance.php rename to .framework/php/src/app/Http/Middleware/PreventRequestsDuringMaintenance.php diff --git a/src/app/Http/Middleware/RedirectIfAuthenticated.php b/.framework/php/src/app/Http/Middleware/RedirectIfAuthenticated.php similarity index 59% rename from src/app/Http/Middleware/RedirectIfAuthenticated.php rename to .framework/php/src/app/Http/Middleware/RedirectIfAuthenticated.php index a2813a0..afc78c4 100644 --- a/src/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/.framework/php/src/app/Http/Middleware/RedirectIfAuthenticated.php @@ -6,18 +6,16 @@ use Closure; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; +use Symfony\Component\HttpFoundation\Response; class RedirectIfAuthenticated { /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next - * @param string|null ...$guards - * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse + * @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next */ - public function handle(Request $request, Closure $next, ...$guards) + public function handle(Request $request, Closure $next, string ...$guards): Response { $guards = empty($guards) ? [null] : $guards; diff --git a/src/app/Http/Middleware/TrimStrings.php b/.framework/php/src/app/Http/Middleware/TrimStrings.php similarity index 100% rename from src/app/Http/Middleware/TrimStrings.php rename to .framework/php/src/app/Http/Middleware/TrimStrings.php diff --git a/src/app/Http/Middleware/TrustHosts.php b/.framework/php/src/app/Http/Middleware/TrustHosts.php similarity index 90% rename from src/app/Http/Middleware/TrustHosts.php rename to .framework/php/src/app/Http/Middleware/TrustHosts.php index 7186414..c9c58bd 100644 --- a/src/app/Http/Middleware/TrustHosts.php +++ b/.framework/php/src/app/Http/Middleware/TrustHosts.php @@ -11,7 +11,7 @@ class TrustHosts extends Middleware * * @return array */ - public function hosts() + public function hosts(): array { return [ $this->allSubdomainsOfApplicationUrl(), diff --git a/src/app/Http/Middleware/TrustProxies.php b/.framework/php/src/app/Http/Middleware/TrustProxies.php similarity index 100% rename from src/app/Http/Middleware/TrustProxies.php rename to .framework/php/src/app/Http/Middleware/TrustProxies.php diff --git a/.framework/php/src/app/Http/Middleware/ValidateSignature.php b/.framework/php/src/app/Http/Middleware/ValidateSignature.php new file mode 100644 index 0000000..093bf64 --- /dev/null +++ b/.framework/php/src/app/Http/Middleware/ValidateSignature.php @@ -0,0 +1,22 @@ + + */ + protected $except = [ + // 'fbclid', + // 'utm_campaign', + // 'utm_content', + // 'utm_medium', + // 'utm_source', + // 'utm_term', + ]; +} diff --git a/src/app/Http/Middleware/VerifyCsrfToken.php b/.framework/php/src/app/Http/Middleware/VerifyCsrfToken.php similarity index 100% rename from src/app/Http/Middleware/VerifyCsrfToken.php rename to .framework/php/src/app/Http/Middleware/VerifyCsrfToken.php diff --git a/src/app/Models/User.php b/.framework/php/src/app/Models/User.php similarity index 91% rename from src/app/Models/User.php rename to .framework/php/src/app/Models/User.php index 8996368..4d7f70f 100644 --- a/src/app/Models/User.php +++ b/.framework/php/src/app/Models/User.php @@ -2,7 +2,7 @@ namespace App\Models; -use Illuminate\Contracts\Auth\MustVerifyEmail; +// use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; @@ -40,5 +40,6 @@ class User extends Authenticatable */ protected $casts = [ 'email_verified_at' => 'datetime', + 'password' => 'hashed', ]; } diff --git a/src/app/Providers/AppServiceProvider.php b/.framework/php/src/app/Providers/AppServiceProvider.php similarity index 72% rename from src/app/Providers/AppServiceProvider.php rename to .framework/php/src/app/Providers/AppServiceProvider.php index ee8ca5b..452e6b6 100644 --- a/src/app/Providers/AppServiceProvider.php +++ b/.framework/php/src/app/Providers/AppServiceProvider.php @@ -8,20 +8,16 @@ class AppServiceProvider extends ServiceProvider { /** * Register any application services. - * - * @return void */ - public function register() + public function register(): void { // } /** * Bootstrap any application services. - * - * @return void */ - public function boot() + public function boot(): void { // } diff --git a/src/app/Providers/AuthServiceProvider.php b/.framework/php/src/app/Providers/AuthServiceProvider.php similarity index 61% rename from src/app/Providers/AuthServiceProvider.php rename to .framework/php/src/app/Providers/AuthServiceProvider.php index 22b77e6..54756cd 100644 --- a/src/app/Providers/AuthServiceProvider.php +++ b/.framework/php/src/app/Providers/AuthServiceProvider.php @@ -2,29 +2,25 @@ namespace App\Providers; +// use Illuminate\Support\Facades\Gate; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; -use Illuminate\Support\Facades\Gate; class AuthServiceProvider extends ServiceProvider { /** - * The policy mappings for the application. + * The model to policy mappings for the application. * * @var array */ protected $policies = [ - // 'App\Models\Model' => 'App\Policies\ModelPolicy', + // ]; /** * Register any authentication / authorization services. - * - * @return void */ - public function boot() + public function boot(): void { - $this->registerPolicies(); - // } } diff --git a/src/app/Providers/BroadcastServiceProvider.php b/.framework/php/src/app/Providers/BroadcastServiceProvider.php similarity index 85% rename from src/app/Providers/BroadcastServiceProvider.php rename to .framework/php/src/app/Providers/BroadcastServiceProvider.php index 395c518..2be04f5 100644 --- a/src/app/Providers/BroadcastServiceProvider.php +++ b/.framework/php/src/app/Providers/BroadcastServiceProvider.php @@ -9,10 +9,8 @@ class BroadcastServiceProvider extends ServiceProvider { /** * Bootstrap any application services. - * - * @return void */ - public function boot() + public function boot(): void { Broadcast::routes(); diff --git a/src/app/Providers/EventServiceProvider.php b/.framework/php/src/app/Providers/EventServiceProvider.php similarity index 69% rename from src/app/Providers/EventServiceProvider.php rename to .framework/php/src/app/Providers/EventServiceProvider.php index 23499eb..2d65aac 100644 --- a/src/app/Providers/EventServiceProvider.php +++ b/.framework/php/src/app/Providers/EventServiceProvider.php @@ -10,7 +10,7 @@ class EventServiceProvider extends ServiceProvider { /** - * The event listener mappings for the application. + * The event to listener mappings for the application. * * @var array> */ @@ -22,11 +22,17 @@ class EventServiceProvider extends ServiceProvider /** * Register any events for your application. - * - * @return void */ - public function boot() + public function boot(): void { // } + + /** + * Determine if events and listeners should be automatically discovered. + */ + public function shouldDiscoverEvents(): bool + { + return false; + } } diff --git a/.framework/php/src/app/Providers/RouteServiceProvider.php b/.framework/php/src/app/Providers/RouteServiceProvider.php new file mode 100644 index 0000000..1cf5f15 --- /dev/null +++ b/.framework/php/src/app/Providers/RouteServiceProvider.php @@ -0,0 +1,40 @@ +by($request->user()?->id ?: $request->ip()); + }); + + $this->routes(function () { + Route::middleware('api') + ->prefix('api') + ->group(base_path('routes/api.php')); + + Route::middleware('web') + ->group(base_path('routes/web.php')); + }); + } +} diff --git a/src/artisan b/.framework/php/src/artisan similarity index 100% rename from src/artisan rename to .framework/php/src/artisan diff --git a/src/bootstrap/app.php b/.framework/php/src/bootstrap/app.php similarity index 100% rename from src/bootstrap/app.php rename to .framework/php/src/bootstrap/app.php diff --git a/src/bootstrap/cache/.gitignore b/.framework/php/src/bootstrap/cache/.gitignore similarity index 100% rename from src/bootstrap/cache/.gitignore rename to .framework/php/src/bootstrap/cache/.gitignore diff --git a/src/composer.json b/.framework/php/src/composer.json similarity index 64% rename from src/composer.json rename to .framework/php/src/composer.json index a41d46f..e1fb449 100644 --- a/src/composer.json +++ b/.framework/php/src/composer.json @@ -1,23 +1,24 @@ { - "name": "mongodb-developer/laravel9-mongodb-tutorial", + "name": "laravel/laravel", "type": "project", - "description": "A tutorial to shows how to connect and use Laravel with MongoDB", - "keywords": ["framework", "laravel"], + "description": "The skeleton application for the Laravel framework.", + "keywords": ["laravel", "framework"], "license": "MIT", "require": { "php": "^8.1", "guzzlehttp/guzzle": "^7.2", - "laravel/framework": "^10.0", - "laravel/sanctum": "^3.3", + "laravel/framework": "^10.10", + "laravel/sanctum": "^3.2", "laravel/tinker": "^2.8" }, "require-dev": { - "fakerphp/faker": "^1.23", - "laravel/sail": "^1.25", - "mockery/mockery": "^1.6", - "nunomaduro/collision": "^7.8", - "phpunit/phpunit": "^10.0", - "spatie/laravel-ignition": "^2.3" + "fakerphp/faker": "^1.9.1", + "laravel/pint": "^1.0", + "laravel/sail": "^1.18", + "mockery/mockery": "^1.4.4", + "nunomaduro/collision": "^7.0", + "phpunit/phpunit": "^10.1", + "spatie/laravel-ignition": "^2.0" }, "autoload": { "psr-4": { @@ -54,8 +55,12 @@ "config": { "optimize-autoloader": true, "preferred-install": "dist", - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "pestphp/pest-plugin": true, + "php-http/discovery": true + } }, - "minimum-stability": "dev", + "minimum-stability": "stable", "prefer-stable": true } diff --git a/src/composer.lock b/.framework/php/src/composer.lock similarity index 95% rename from src/composer.lock rename to .framework/php/src/composer.lock index ee85361..be951df 100644 --- a/src/composer.lock +++ b/.framework/php/src/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "571df8b1d5041dad6ec0ab7a89750104", + "content-hash": "aa322c53454393ed775cfe4807d54a50", "packages": [ { "name": "brick/math", @@ -970,77 +970,18 @@ ], "time": "2023-08-27T10:19:19+00:00" }, - { - "name": "jean85/pretty-package-versions", - "version": "2.0.5", - "source": { - "type": "git", - "url": "https://github.com/Jean85/pretty-package-versions.git", - "reference": "ae547e455a3d8babd07b96966b17d7fd21d9c6af" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/ae547e455a3d8babd07b96966b17d7fd21d9c6af", - "reference": "ae547e455a3d8babd07b96966b17d7fd21d9c6af", - "shasum": "" - }, - "require": { - "composer-runtime-api": "^2.0.0", - "php": "^7.1|^8.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.17", - "jean85/composer-provided-replaced-stub-package": "^1.0", - "phpstan/phpstan": "^0.12.66", - "phpunit/phpunit": "^7.5|^8.5|^9.4", - "vimeo/psalm": "^4.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Jean85\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Alessandro Lai", - "email": "alessandro.lai85@gmail.com" - } - ], - "description": "A library to get pretty versions strings of installed dependencies", - "keywords": [ - "composer", - "package", - "release", - "versions" - ], - "support": { - "issues": "https://github.com/Jean85/pretty-package-versions/issues", - "source": "https://github.com/Jean85/pretty-package-versions/tree/2.0.5" - }, - "time": "2021-10-08T21:21:46+00:00" - }, { "name": "laravel/framework", - "version": "v10.23.0", + "version": "v10.23.1", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "7d6a79ce8ff52a4d0d385ac290dcc048aa514ce7" + "reference": "dbfd495557678759153e8d71cc2f6027686ca51e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/7d6a79ce8ff52a4d0d385ac290dcc048aa514ce7", - "reference": "7d6a79ce8ff52a4d0d385ac290dcc048aa514ce7", + "url": "https://api.github.com/repos/laravel/framework/zipball/dbfd495557678759153e8d71cc2f6027686ca51e", + "reference": "dbfd495557678759153e8d71cc2f6027686ca51e", "shasum": "" }, "require": { @@ -1140,7 +1081,7 @@ "league/flysystem-read-only": "^3.3", "league/flysystem-sftp-v3": "^3.0", "mockery/mockery": "^1.5.1", - "orchestra/testbench-core": "^8.4", + "orchestra/testbench-core": "^8.10", "pda/pheanstalk": "^4.0", "phpstan/phpstan": "^1.4.7", "phpunit/phpunit": "^10.0.7", @@ -1227,7 +1168,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-09-12T15:55:31+00:00" + "time": "2023-09-13T14:51:46+00:00" }, { "name": "laravel/prompts", @@ -1866,171 +1807,6 @@ ], "time": "2023-08-05T12:09:49+00:00" }, - { - "name": "mongodb/laravel-mongodb", - "version": "4.0.0-rc1", - "source": { - "type": "git", - "url": "https://github.com/mongodb/laravel-mongodb.git", - "reference": "c112ef77d180b9c941d9c7905610d1af555da334" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/mongodb/laravel-mongodb/zipball/c112ef77d180b9c941d9c7905610d1af555da334", - "reference": "c112ef77d180b9c941d9c7905610d1af555da334", - "shasum": "" - }, - "require": { - "ext-mongodb": "^1.15", - "illuminate/container": "^10.0", - "illuminate/database": "^10.0", - "illuminate/events": "^10.0", - "illuminate/support": "^10.0", - "mongodb/mongodb": "^1.15", - "php": "^8.1" - }, - "replace": { - "jenssegers/mongodb": "self.version" - }, - "require-dev": { - "doctrine/coding-standard": "12.0.x-dev", - "mockery/mockery": "^1.4.4", - "orchestra/testbench": "^8.0", - "phpunit/phpunit": "^10.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0.x-dev" - }, - "laravel": { - "providers": [ - "MongoDB\\Laravel\\MongoDBServiceProvider", - "MongoDB\\Laravel\\MongoDBQueueServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "MongoDB\\Laravel\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Andreas Braun", - "email": "andreas.braun@mongodb.com", - "role": "Leader" - }, - { - "name": "Jérôme Tamarelle", - "email": "jerome.tamarelle@mongodb.com", - "role": "Maintainer" - }, - { - "name": "Jeremy Mikola", - "email": "jmikola@gmail.com", - "role": "Maintainer" - }, - { - "name": "Jens Segers", - "homepage": "https://jenssegers.com", - "role": "Creator" - } - ], - "description": "A MongoDB based Eloquent model and Query builder for Laravel", - "homepage": "https://github.com/mongodb/laravel-mongodb", - "keywords": [ - "database", - "eloquent", - "laravel", - "model", - "mongo", - "mongodb" - ], - "support": { - "issues": "https://www.mongodb.com/support", - "security": "https://www.mongodb.com/security", - "source": "https://github.com/mongodb/laravel-mongodb/tree/4.0.0-rc1" - }, - "time": "2023-09-13T08:43:07+00:00" - }, - { - "name": "mongodb/mongodb", - "version": "1.16.0", - "source": { - "type": "git", - "url": "https://github.com/mongodb/mongo-php-library.git", - "reference": "d4cdf057a67cb99a32db8984a16959bfa7ca7eb5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/d4cdf057a67cb99a32db8984a16959bfa7ca7eb5", - "reference": "d4cdf057a67cb99a32db8984a16959bfa7ca7eb5", - "shasum": "" - }, - "require": { - "ext-hash": "*", - "ext-json": "*", - "ext-mongodb": "^1.16.0", - "jean85/pretty-package-versions": "^2.0.1", - "php": "^7.2 || ^8.0", - "symfony/polyfill-php73": "^1.27", - "symfony/polyfill-php80": "^1.27", - "symfony/polyfill-php81": "^1.27" - }, - "require-dev": { - "doctrine/coding-standard": "^11.1", - "rector/rector": "^0.16.0", - "squizlabs/php_codesniffer": "^3.7", - "symfony/phpunit-bridge": "^5.2", - "vimeo/psalm": "^4.28" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.16.x-dev" - } - }, - "autoload": { - "files": [ - "src/functions.php" - ], - "psr-4": { - "MongoDB\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Andreas Braun", - "email": "andreas.braun@mongodb.com" - }, - { - "name": "Jeremy Mikola", - "email": "jmikola@gmail.com" - } - ], - "description": "MongoDB driver library", - "homepage": "https://jira.mongodb.org/browse/PHPLIB", - "keywords": [ - "database", - "driver", - "mongodb", - "persistence" - ], - "support": { - "issues": "https://github.com/mongodb/mongo-php-library/issues", - "source": "https://github.com/mongodb/mongo-php-library/tree/1.16.0" - }, - "time": "2023-06-22T11:04:04+00:00" - }, { "name": "monolog/monolog", "version": "3.4.0", @@ -3018,16 +2794,16 @@ }, { "name": "psy/psysh", - "version": "v0.11.20", + "version": "v0.11.21", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "0fa27040553d1d280a67a4393194df5228afea5b" + "reference": "bcb22101107f3bf770523b65630c9d547f60c540" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/0fa27040553d1d280a67a4393194df5228afea5b", - "reference": "0fa27040553d1d280a67a4393194df5228afea5b", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/bcb22101107f3bf770523b65630c9d547f60c540", + "reference": "bcb22101107f3bf770523b65630c9d547f60c540", "shasum": "" }, "require": { @@ -3057,6 +2833,10 @@ "extra": { "branch-alias": { "dev-main": "0.11.x-dev" + }, + "bamarni-bin": { + "bin-links": false, + "forward-command": false } }, "autoload": { @@ -3088,9 +2868,9 @@ ], "support": { "issues": "https://github.com/bobthecow/psysh/issues", - "source": "https://github.com/bobthecow/psysh/tree/v0.11.20" + "source": "https://github.com/bobthecow/psysh/tree/v0.11.21" }, - "time": "2023-07-31T14:32:22+00:00" + "time": "2023-09-17T21:15:54+00:00" }, { "name": "ralouphie/getallheaders", @@ -4680,85 +4460,6 @@ ], "time": "2023-01-26T09:26:14+00:00" }, - { - "name": "symfony/polyfill-php73", - "version": "v1.28.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fe2f306d1d9d346a7fee353d0d5012e401e984b5", - "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.28.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2023-01-26T09:26:14+00:00" - }, { "name": "symfony/polyfill-php80", "version": "v1.28.0", @@ -4842,85 +4543,6 @@ ], "time": "2023-01-26T09:26:14+00:00" }, - { - "name": "symfony/polyfill-php81", - "version": "v1.28.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "7581cd600fa9fd681b797d00b02f068e2f13263b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/7581cd600fa9fd681b797d00b02f068e2f13263b", - "reference": "7581cd600fa9fd681b797d00b02f068e2f13263b", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php81\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.28.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2023-01-26T09:26:14+00:00" - }, { "name": "symfony/polyfill-php83", "version": "v1.28.0", @@ -6187,6 +5809,72 @@ }, "time": "2020-07-09T08:09:16+00:00" }, + { + "name": "laravel/pint", + "version": "v1.13.1", + "source": { + "type": "git", + "url": "https://github.com/laravel/pint.git", + "reference": "22f204242d68095b3ba7dab5d3ef0240454a4652" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/pint/zipball/22f204242d68095b3ba7dab5d3ef0240454a4652", + "reference": "22f204242d68095b3ba7dab5d3ef0240454a4652", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-mbstring": "*", + "ext-tokenizer": "*", + "ext-xml": "*", + "php": "^8.1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.21.1", + "illuminate/view": "^10.5.1", + "laravel-zero/framework": "^10.1.2", + "mockery/mockery": "^1.5.1", + "nunomaduro/larastan": "^2.5.1", + "nunomaduro/termwind": "^1.15.1", + "pestphp/pest": "^2.4.0" + }, + "bin": [ + "builds/pint" + ], + "type": "project", + "autoload": { + "psr-4": { + "App\\": "app/", + "Database\\Seeders\\": "database/seeders/", + "Database\\Factories\\": "database/factories/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "description": "An opinionated code formatter for PHP.", + "homepage": "https://laravel.com", + "keywords": [ + "format", + "formatter", + "lint", + "linter", + "php" + ], + "support": { + "issues": "https://github.com/laravel/pint/issues", + "source": "https://github.com/laravel/pint" + }, + "time": "2023-09-06T11:03:34+00:00" + }, { "name": "laravel/sail", "version": "v1.25.0", @@ -7457,16 +7145,16 @@ }, { "name": "sebastian/exporter", - "version": "5.0.1", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "32ff03d078fed1279c4ec9a407d08c5e9febb480" + "reference": "c3fa8483f9539b190f7cd4bfc4a07631dd1df344" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/32ff03d078fed1279c4ec9a407d08c5e9febb480", - "reference": "32ff03d078fed1279c4ec9a407d08c5e9febb480", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/c3fa8483f9539b190f7cd4bfc4a07631dd1df344", + "reference": "c3fa8483f9539b190f7cd4bfc4a07631dd1df344", "shasum": "" }, "require": { @@ -7523,7 +7211,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", "security": "https://github.com/sebastianbergmann/exporter/security/policy", - "source": "https://github.com/sebastianbergmann/exporter/tree/5.0.1" + "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.0" }, "funding": [ { @@ -7531,7 +7219,7 @@ "type": "github" } ], - "time": "2023-09-08T04:46:58+00:00" + "time": "2023-09-18T07:15:37+00:00" }, { "name": "sebastian/global-state", @@ -8368,7 +8056,7 @@ } ], "aliases": [], - "minimum-stability": "dev", + "minimum-stability": "stable", "stability-flags": [], "prefer-stable": true, "prefer-lowest": false, diff --git a/src/config/app.php b/.framework/php/src/config/app.php similarity index 78% rename from src/config/app.php rename to .framework/php/src/config/app.php index 46e01b7..4c231b4 100644 --- a/src/config/app.php +++ b/.framework/php/src/config/app.php @@ -1,6 +1,7 @@ env('APP_URL', 'http://localhost'), - 'asset_url' => env('ASSET_URL', null), + 'asset_url' => env('ASSET_URL'), /* |-------------------------------------------------------------------------- @@ -125,6 +126,24 @@ 'cipher' => 'AES-256-CBC', + /* + |-------------------------------------------------------------------------- + | Maintenance Mode Driver + |-------------------------------------------------------------------------- + | + | These configuration options determine the driver used to determine and + | manage Laravel's "maintenance mode" status. The "cache" driver will + | allow maintenance mode to be controlled across multiple machines. + | + | Supported drivers: "file", "cache" + | + */ + + 'maintenance' => [ + 'driver' => 'file', + // 'store' => 'redis', + ], + /* |-------------------------------------------------------------------------- | Autoloaded Service Providers @@ -136,36 +155,7 @@ | */ - 'providers' => [ - - /* - * Laravel Framework Service Providers... - */ - Illuminate\Auth\AuthServiceProvider::class, - Illuminate\Broadcasting\BroadcastServiceProvider::class, - Illuminate\Bus\BusServiceProvider::class, - Illuminate\Cache\CacheServiceProvider::class, - Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, - Illuminate\Cookie\CookieServiceProvider::class, - Illuminate\Database\DatabaseServiceProvider::class, - Illuminate\Encryption\EncryptionServiceProvider::class, - Illuminate\Filesystem\FilesystemServiceProvider::class, - Illuminate\Foundation\Providers\FoundationServiceProvider::class, - Illuminate\Hashing\HashServiceProvider::class, - Illuminate\Mail\MailServiceProvider::class, - Illuminate\Notifications\NotificationServiceProvider::class, - Illuminate\Pagination\PaginationServiceProvider::class, - Illuminate\Pipeline\PipelineServiceProvider::class, - Illuminate\Queue\QueueServiceProvider::class, - Illuminate\Redis\RedisServiceProvider::class, - Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, - Illuminate\Session\SessionServiceProvider::class, - Illuminate\Translation\TranslationServiceProvider::class, - Illuminate\Validation\ValidationServiceProvider::class, - Illuminate\View\ViewServiceProvider::class, - - MongoDB\Laravel\MongoDBServiceProvider::class, - + 'providers' => ServiceProvider::defaultProviders()->merge([ /* * Package Service Providers... */ @@ -178,8 +168,7 @@ // App\Providers\BroadcastServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, - - ], + ])->toArray(), /* |-------------------------------------------------------------------------- @@ -193,7 +182,7 @@ */ 'aliases' => Facade::defaultAliases()->merge([ - // ... + // 'Example' => App\Facades\Example::class, ])->toArray(), ]; diff --git a/src/config/auth.php b/.framework/php/src/config/auth.php similarity index 91% rename from src/config/auth.php rename to .framework/php/src/config/auth.php index d8c6cee..9548c15 100644 --- a/src/config/auth.php +++ b/.framework/php/src/config/auth.php @@ -80,16 +80,20 @@ | than one user table or model in the application and you want to have | separate password reset settings based on the specific user types. | - | The expire time is the number of minutes that each reset token will be + | The expiry time is the number of minutes that each reset token will be | considered valid. This security feature keeps tokens short-lived so | they have less time to be guessed. You may change this as needed. | + | The throttle setting is the number of seconds a user must wait before + | generating more password reset tokens. This prevents the user from + | quickly generating a very large amount of password reset tokens. + | */ 'passwords' => [ 'users' => [ 'provider' => 'users', - 'table' => 'password_resets', + 'table' => 'password_reset_tokens', 'expire' => 60, 'throttle' => 60, ], diff --git a/src/config/broadcasting.php b/.framework/php/src/config/broadcasting.php similarity index 85% rename from src/config/broadcasting.php rename to .framework/php/src/config/broadcasting.php index 67fcbbd..2410485 100644 --- a/src/config/broadcasting.php +++ b/.framework/php/src/config/broadcasting.php @@ -37,7 +37,11 @@ 'app_id' => env('PUSHER_APP_ID'), 'options' => [ 'cluster' => env('PUSHER_APP_CLUSTER'), - 'useTLS' => true, + 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', + 'port' => env('PUSHER_PORT', 443), + 'scheme' => env('PUSHER_SCHEME', 'https'), + 'encrypted' => true, + 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', ], 'client_options' => [ // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html diff --git a/src/config/cache.php b/.framework/php/src/config/cache.php similarity index 90% rename from src/config/cache.php rename to .framework/php/src/config/cache.php index 8736c7a..d4171e2 100644 --- a/src/config/cache.php +++ b/.framework/php/src/config/cache.php @@ -52,6 +52,7 @@ 'file' => [ 'driver' => 'file', 'path' => storage_path('framework/cache/data'), + 'lock_path' => storage_path('framework/cache/data'), ], 'memcached' => [ @@ -99,12 +100,12 @@ | Cache Key Prefix |-------------------------------------------------------------------------- | - | When utilizing a RAM based store such as APC or Memcached, there might - | be other applications utilizing the same cache. So, we'll specify a - | value to get prefixed to all our keys so we can avoid collisions. + | When utilizing the APC, database, memcached, Redis, or DynamoDB cache + | stores there might be other applications using the same cache. For + | that reason, you may prefix every cache key to avoid collisions. | */ - 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'), + 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'), ]; diff --git a/src/config/cors.php b/.framework/php/src/config/cors.php similarity index 100% rename from src/config/cors.php rename to .framework/php/src/config/cors.php diff --git a/src/config/database.php b/.framework/php/src/config/database.php similarity index 90% rename from src/config/database.php rename to .framework/php/src/config/database.php index e8db9bd..137ad18 100644 --- a/src/config/database.php +++ b/.framework/php/src/config/database.php @@ -15,7 +15,7 @@ | */ - 'default' => env('DB_CONNECTION', 'mongodb'), + 'default' => env('DB_CONNECTION', 'mysql'), /* |-------------------------------------------------------------------------- @@ -35,19 +35,6 @@ 'connections' => [ - 'mongodb' => [ - 'driver' => 'mongodb', - 'dsn' => env('MONGODB_URI'), - 'database' => 'bigsearch', // replace 'bigsearch' with your database name - ], - - 'mongodb_mflix' => [ - 'driver' => 'mongodb', - 'dsn' => env('MONGODB_URI'), - 'database' => 'sample_mflix', - ], - - 'sqlite' => [ 'driver' => 'sqlite', 'url' => env('DATABASE_URL'), @@ -61,8 +48,8 @@ 'url' => env('DATABASE_URL'), 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), - 'database' => env('DB_DATABASE', ''), - 'username' => env('DB_USERNAME', ''), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'unix_socket' => env('DB_SOCKET', ''), 'charset' => 'utf8mb4', @@ -102,6 +89,8 @@ 'charset' => 'utf8', 'prefix' => '', 'prefix_indexes' => true, + // 'encrypt' => env('DB_ENCRYPT', 'yes'), + // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'), ], ], @@ -142,6 +131,7 @@ 'default' => [ 'url' => env('REDIS_URL'), 'host' => env('REDIS_HOST', '127.0.0.1'), + 'username' => env('REDIS_USERNAME'), 'password' => env('REDIS_PASSWORD'), 'port' => env('REDIS_PORT', '6379'), 'database' => env('REDIS_DB', '0'), @@ -150,6 +140,7 @@ 'cache' => [ 'url' => env('REDIS_URL'), 'host' => env('REDIS_HOST', '127.0.0.1'), + 'username' => env('REDIS_USERNAME'), 'password' => env('REDIS_PASSWORD'), 'port' => env('REDIS_PORT', '6379'), 'database' => env('REDIS_CACHE_DB', '1'), @@ -157,4 +148,4 @@ ], -]; \ No newline at end of file +]; diff --git a/src/config/filesystems.php b/.framework/php/src/config/filesystems.php similarity index 93% rename from src/config/filesystems.php rename to .framework/php/src/config/filesystems.php index cf5abce..e9d9dbd 100644 --- a/src/config/filesystems.php +++ b/.framework/php/src/config/filesystems.php @@ -22,7 +22,7 @@ | | Here you may configure as many filesystem "disks" as you wish, and you | may even configure multiple disks of the same driver. Defaults have - | been setup for each driver as an example of the required options. + | been set up for each driver as an example of the required values. | | Supported Drivers: "local", "ftp", "sftp", "s3" | @@ -33,6 +33,7 @@ 'local' => [ 'driver' => 'local', 'root' => storage_path('app'), + 'throw' => false, ], 'public' => [ @@ -40,6 +41,7 @@ 'root' => storage_path('app/public'), 'url' => env('APP_URL').'/storage', 'visibility' => 'public', + 'throw' => false, ], 's3' => [ @@ -51,6 +53,7 @@ 'url' => env('AWS_URL'), 'endpoint' => env('AWS_ENDPOINT'), 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), + 'throw' => false, ], ], diff --git a/src/config/hashing.php b/.framework/php/src/config/hashing.php similarity index 100% rename from src/config/hashing.php rename to .framework/php/src/config/hashing.php diff --git a/src/config/logging.php b/.framework/php/src/config/logging.php similarity index 86% rename from src/config/logging.php rename to .framework/php/src/config/logging.php index fefe088..c44d276 100644 --- a/src/config/logging.php +++ b/.framework/php/src/config/logging.php @@ -3,6 +3,7 @@ use Monolog\Handler\NullHandler; use Monolog\Handler\StreamHandler; use Monolog\Handler\SyslogUdpHandler; +use Monolog\Processor\PsrLogMessageProcessor; return [ @@ -30,7 +31,10 @@ | */ - 'deprecations' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), + 'deprecations' => [ + 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), + 'trace' => false, + ], /* |-------------------------------------------------------------------------- @@ -58,6 +62,7 @@ 'driver' => 'single', 'path' => storage_path('logs/laravel.log'), 'level' => env('LOG_LEVEL', 'debug'), + 'replace_placeholders' => true, ], 'daily' => [ @@ -65,6 +70,7 @@ 'path' => storage_path('logs/laravel.log'), 'level' => env('LOG_LEVEL', 'debug'), 'days' => 14, + 'replace_placeholders' => true, ], 'slack' => [ @@ -73,6 +79,7 @@ 'username' => 'Laravel Log', 'emoji' => ':boom:', 'level' => env('LOG_LEVEL', 'critical'), + 'replace_placeholders' => true, ], 'papertrail' => [ @@ -84,6 +91,7 @@ 'port' => env('PAPERTRAIL_PORT'), 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'), ], + 'processors' => [PsrLogMessageProcessor::class], ], 'stderr' => [ @@ -94,16 +102,20 @@ 'with' => [ 'stream' => 'php://stderr', ], + 'processors' => [PsrLogMessageProcessor::class], ], 'syslog' => [ 'driver' => 'syslog', 'level' => env('LOG_LEVEL', 'debug'), + 'facility' => LOG_USER, + 'replace_placeholders' => true, ], 'errorlog' => [ 'driver' => 'errorlog', 'level' => env('LOG_LEVEL', 'debug'), + 'replace_placeholders' => true, ], 'null' => [ diff --git a/src/config/mail.php b/.framework/php/src/config/mail.php similarity index 91% rename from src/config/mail.php rename to .framework/php/src/config/mail.php index 87b6fe3..e652bd0 100644 --- a/src/config/mail.php +++ b/.framework/php/src/config/mail.php @@ -28,7 +28,7 @@ | sending an e-mail. You will specify which one you are using for your | mailers below. You are free to add additional mailers as required. | - | Supported: "smtp", "sendmail", "mailgun", "ses", + | Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2", | "postmark", "log", "array", "failover" | */ @@ -36,12 +36,14 @@ 'mailers' => [ 'smtp' => [ 'transport' => 'smtp', + 'url' => env('MAIL_URL'), 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 'port' => env('MAIL_PORT', 587), 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 'username' => env('MAIL_USERNAME'), 'password' => env('MAIL_PASSWORD'), 'timeout' => null, + 'local_domain' => env('MAIL_EHLO_DOMAIN'), ], 'ses' => [ @@ -50,15 +52,21 @@ 'mailgun' => [ 'transport' => 'mailgun', + // 'client' => [ + // 'timeout' => 5, + // ], ], 'postmark' => [ 'transport' => 'postmark', + // 'client' => [ + // 'timeout' => 5, + // ], ], 'sendmail' => [ 'transport' => 'sendmail', - 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -t -i'), + 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), ], 'log' => [ diff --git a/src/config/queue.php b/.framework/php/src/config/queue.php similarity index 84% rename from src/config/queue.php rename to .framework/php/src/config/queue.php index 25ea5a8..01c6b05 100644 --- a/src/config/queue.php +++ b/.framework/php/src/config/queue.php @@ -73,6 +73,22 @@ ], + /* + |-------------------------------------------------------------------------- + | Job Batching + |-------------------------------------------------------------------------- + | + | The following options configure the database and table that store job + | batching information. These options can be updated to any database + | connection and table which has been defined by your application. + | + */ + + 'batching' => [ + 'database' => env('DB_CONNECTION', 'mysql'), + 'table' => 'job_batches', + ], + /* |-------------------------------------------------------------------------- | Failed Queue Jobs diff --git a/src/config/sanctum.php b/.framework/php/src/config/sanctum.php similarity index 96% rename from src/config/sanctum.php rename to .framework/php/src/config/sanctum.php index 9281c92..529cfdc 100644 --- a/src/config/sanctum.php +++ b/.framework/php/src/config/sanctum.php @@ -1,5 +1,7 @@ explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( '%s%s', 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', - env('APP_URL') ? ','.parse_url(env('APP_URL'), PHP_URL_HOST) : '' + Sanctum::currentApplicationUrlWithPort() ))), /* diff --git a/src/config/services.php b/.framework/php/src/config/services.php similarity index 97% rename from src/config/services.php rename to .framework/php/src/config/services.php index 2a1d616..0ace530 100644 --- a/src/config/services.php +++ b/.framework/php/src/config/services.php @@ -18,6 +18,7 @@ 'domain' => env('MAILGUN_DOMAIN'), 'secret' => env('MAILGUN_SECRET'), 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), + 'scheme' => 'https', ], 'postmark' => [ diff --git a/src/config/session.php b/.framework/php/src/config/session.php similarity index 100% rename from src/config/session.php rename to .framework/php/src/config/session.php diff --git a/src/config/view.php b/.framework/php/src/config/view.php similarity index 100% rename from src/config/view.php rename to .framework/php/src/config/view.php diff --git a/src/database/.gitignore b/.framework/php/src/database/.gitignore similarity index 100% rename from src/database/.gitignore rename to .framework/php/src/database/.gitignore diff --git a/src/database/factories/UserFactory.php b/.framework/php/src/database/factories/UserFactory.php similarity index 60% rename from src/database/factories/UserFactory.php rename to .framework/php/src/database/factories/UserFactory.php index d6ca926..a6ecc0a 100644 --- a/src/database/factories/UserFactory.php +++ b/.framework/php/src/database/factories/UserFactory.php @@ -13,13 +13,13 @@ class UserFactory extends Factory /** * Define the model's default state. * - * @return array + * @return array */ - public function definition() + public function definition(): array { return [ - 'name' => $this->faker->name(), - 'email' => $this->faker->unique()->safeEmail(), + 'name' => fake()->name(), + 'email' => fake()->unique()->safeEmail(), 'email_verified_at' => now(), 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 'remember_token' => Str::random(10), @@ -28,15 +28,11 @@ public function definition() /** * Indicate that the model's email address should be unverified. - * - * @return \Illuminate\Database\Eloquent\Factories\Factory */ - public function unverified() + public function unverified(): static { - return $this->state(function (array $attributes) { - return [ - 'email_verified_at' => null, - ]; - }); + return $this->state(fn (array $attributes) => [ + 'email_verified_at' => null, + ]); } } diff --git a/src/database/migrations/2014_10_12_000000_create_users_table.php b/.framework/php/src/database/migrations/2014_10_12_000000_create_users_table.php similarity index 86% rename from src/database/migrations/2014_10_12_000000_create_users_table.php rename to .framework/php/src/database/migrations/2014_10_12_000000_create_users_table.php index cf6b776..444fafb 100644 --- a/src/database/migrations/2014_10_12_000000_create_users_table.php +++ b/.framework/php/src/database/migrations/2014_10_12_000000_create_users_table.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('users', function (Blueprint $table) { $table->id(); @@ -26,10 +24,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('users'); } diff --git a/src/database/migrations/2014_10_12_100000_create_password_resets_table.php b/.framework/php/src/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php similarity index 59% rename from src/database/migrations/2014_10_12_100000_create_password_resets_table.php rename to .framework/php/src/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php index fcacb80..81a7229 100644 --- a/src/database/migrations/2014_10_12_100000_create_password_resets_table.php +++ b/.framework/php/src/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php @@ -8,13 +8,11 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { - Schema::create('password_resets', function (Blueprint $table) { - $table->string('email')->index(); + Schema::create('password_reset_tokens', function (Blueprint $table) { + $table->string('email')->primary(); $table->string('token'); $table->timestamp('created_at')->nullable(); }); @@ -22,11 +20,9 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { - Schema::dropIfExists('password_resets'); + Schema::dropIfExists('password_reset_tokens'); } }; diff --git a/src/database/migrations/2019_08_19_000000_create_failed_jobs_table.php b/.framework/php/src/database/migrations/2019_08_19_000000_create_failed_jobs_table.php similarity index 86% rename from src/database/migrations/2019_08_19_000000_create_failed_jobs_table.php rename to .framework/php/src/database/migrations/2019_08_19_000000_create_failed_jobs_table.php index 1719198..249da81 100644 --- a/src/database/migrations/2019_08_19_000000_create_failed_jobs_table.php +++ b/.framework/php/src/database/migrations/2019_08_19_000000_create_failed_jobs_table.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('failed_jobs', function (Blueprint $table) { $table->id(); @@ -26,10 +24,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('failed_jobs'); } diff --git a/src/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php b/.framework/php/src/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php similarity index 85% rename from src/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php rename to .framework/php/src/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php index fd235f8..e828ad8 100644 --- a/src/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php +++ b/.framework/php/src/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('personal_access_tokens', function (Blueprint $table) { $table->id(); @@ -20,16 +18,15 @@ public function up() $table->string('token', 64)->unique(); $table->text('abilities')->nullable(); $table->timestamp('last_used_at')->nullable(); + $table->timestamp('expires_at')->nullable(); $table->timestamps(); }); } /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('personal_access_tokens'); } diff --git a/.framework/php/src/database/seeders/DatabaseSeeder.php b/.framework/php/src/database/seeders/DatabaseSeeder.php new file mode 100644 index 0000000..a9f4519 --- /dev/null +++ b/.framework/php/src/database/seeders/DatabaseSeeder.php @@ -0,0 +1,22 @@ +create(); + + // \App\Models\User::factory()->create([ + // 'name' => 'Test User', + // 'email' => 'test@example.com', + // ]); + } +} diff --git a/.framework/php/src/package.json b/.framework/php/src/package.json new file mode 100644 index 0000000..0e6480f --- /dev/null +++ b/.framework/php/src/package.json @@ -0,0 +1,13 @@ +{ + "private": true, + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build" + }, + "devDependencies": { + "axios": "^1.1.2", + "laravel-vite-plugin": "^0.8.0", + "vite": "^4.0.0" + } +} diff --git a/src/phpunit.xml b/.framework/php/src/phpunit.xml similarity index 65% rename from src/phpunit.xml rename to .framework/php/src/phpunit.xml index 49661e5..f112c0c 100644 --- a/src/phpunit.xml +++ b/.framework/php/src/phpunit.xml @@ -1,27 +1,28 @@ - ./tests/Unit + tests/Unit - ./tests/Feature + tests/Feature - + - ./app + app - + - + + diff --git a/src/public/.htaccess b/.framework/php/src/public/.htaccess similarity index 100% rename from src/public/.htaccess rename to .framework/php/src/public/.htaccess diff --git a/src/public/favicon.ico b/.framework/php/src/public/favicon.ico similarity index 100% rename from src/public/favicon.ico rename to .framework/php/src/public/favicon.ico diff --git a/src/public/index.php b/.framework/php/src/public/index.php similarity index 99% rename from src/public/index.php rename to .framework/php/src/public/index.php index 93cf96f..1d69f3a 100644 --- a/src/public/index.php +++ b/.framework/php/src/public/index.php @@ -20,8 +20,6 @@ require $maintenance; } - - /* |-------------------------------------------------------------------------- | Register The Auto Loader @@ -55,4 +53,3 @@ )->send(); $kernel->terminate($request, $response); - diff --git a/src/public/robots.txt b/.framework/php/src/public/robots.txt similarity index 100% rename from src/public/robots.txt rename to .framework/php/src/public/robots.txt diff --git a/src/resources/css/app.css b/.framework/php/src/resources/css/app.css similarity index 100% rename from src/resources/css/app.css rename to .framework/php/src/resources/css/app.css diff --git a/.framework/php/src/resources/js/app.js b/.framework/php/src/resources/js/app.js new file mode 100644 index 0000000..e59d6a0 --- /dev/null +++ b/.framework/php/src/resources/js/app.js @@ -0,0 +1 @@ +import './bootstrap'; diff --git a/src/resources/js/bootstrap.js b/.framework/php/src/resources/js/bootstrap.js similarity index 51% rename from src/resources/js/bootstrap.js rename to .framework/php/src/resources/js/bootstrap.js index 6922577..846d350 100644 --- a/src/resources/js/bootstrap.js +++ b/.framework/php/src/resources/js/bootstrap.js @@ -1,12 +1,11 @@ -window._ = require('lodash'); - /** * We'll load the axios HTTP library which allows us to easily issue requests * to our Laravel back-end. This library automatically handles sending the * CSRF token as a header based on the value of the "XSRF" token cookie. */ -window.axios = require('axios'); +import axios from 'axios'; +window.axios = axios; window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; @@ -18,11 +17,16 @@ window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; // import Echo from 'laravel-echo'; -// window.Pusher = require('pusher-js'); +// import Pusher from 'pusher-js'; +// window.Pusher = Pusher; // window.Echo = new Echo({ // broadcaster: 'pusher', -// key: process.env.MIX_PUSHER_APP_KEY, -// cluster: process.env.MIX_PUSHER_APP_CLUSTER, -// forceTLS: true +// key: import.meta.env.VITE_PUSHER_APP_KEY, +// cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'mt1', +// wsHost: import.meta.env.VITE_PUSHER_HOST ? import.meta.env.VITE_PUSHER_HOST : `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`, +// wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80, +// wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443, +// forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https', +// enabledTransports: ['ws', 'wss'], // }); diff --git a/.framework/php/src/resources/views/welcome.blade.php b/.framework/php/src/resources/views/welcome.blade.php new file mode 100644 index 0000000..638ec96 --- /dev/null +++ b/.framework/php/src/resources/views/welcome.blade.php @@ -0,0 +1,140 @@ + + + + + + + Laravel + + + + + + + + + + + + diff --git a/src/routes/api.php b/.framework/php/src/routes/api.php similarity index 71% rename from src/routes/api.php rename to .framework/php/src/routes/api.php index c313c9f..889937e 100644 --- a/src/routes/api.php +++ b/.framework/php/src/routes/api.php @@ -1,7 +1,6 @@ get('/user', function (Request $request) { return $request->user(); -}); \ No newline at end of file +}); diff --git a/src/routes/channels.php b/.framework/php/src/routes/channels.php similarity index 100% rename from src/routes/channels.php rename to .framework/php/src/routes/channels.php diff --git a/src/routes/console.php b/.framework/php/src/routes/console.php similarity index 100% rename from src/routes/console.php rename to .framework/php/src/routes/console.php diff --git a/.framework/php/src/routes/web.php b/.framework/php/src/routes/web.php new file mode 100644 index 0000000..d259f33 --- /dev/null +++ b/.framework/php/src/routes/web.php @@ -0,0 +1,18 @@ +get('/'); diff --git a/src/tests/TestCase.php b/.framework/php/src/tests/TestCase.php similarity index 100% rename from src/tests/TestCase.php rename to .framework/php/src/tests/TestCase.php diff --git a/src/tests/Unit/ExampleTest.php b/.framework/php/src/tests/Unit/ExampleTest.php similarity index 72% rename from src/tests/Unit/ExampleTest.php rename to .framework/php/src/tests/Unit/ExampleTest.php index e5c5fef..5773b0c 100644 --- a/src/tests/Unit/ExampleTest.php +++ b/.framework/php/src/tests/Unit/ExampleTest.php @@ -8,10 +8,8 @@ class ExampleTest extends TestCase { /** * A basic test example. - * - * @return void */ - public function test_that_true_is_true() + public function test_that_true_is_true(): void { $this->assertTrue(true); } diff --git a/.framework/php/src/vite.config.js b/.framework/php/src/vite.config.js new file mode 100644 index 0000000..421b569 --- /dev/null +++ b/.framework/php/src/vite.config.js @@ -0,0 +1,11 @@ +import { defineConfig } from 'vite'; +import laravel from 'laravel-vite-plugin'; + +export default defineConfig({ + plugins: [ + laravel({ + input: ['resources/css/app.css', 'resources/js/app.js'], + refresh: true, + }), + ], +}); diff --git a/src/app/Http/Controllers/PostController.php b/src/app/Http/Controllers/PostController.php deleted file mode 100644 index 97cc49c..0000000 --- a/src/app/Http/Controllers/PostController.php +++ /dev/null @@ -1,20 +0,0 @@ -first(); - - // generated the view defined in [/resources/views]/post.blade.php - return view('post', [ 'post_data' => $query_result ]); - } -} diff --git a/src/app/Models/Author.php b/src/app/Models/Author.php deleted file mode 100644 index 58fad8b..0000000 --- a/src/app/Models/Author.php +++ /dev/null @@ -1,11 +0,0 @@ - ['guid' => 1], 'options' => ['unique' => true]], - ]; -} diff --git a/src/app/Providers/RouteServiceProvider.php b/src/app/Providers/RouteServiceProvider.php deleted file mode 100644 index 7c17d1f..0000000 --- a/src/app/Providers/RouteServiceProvider.php +++ /dev/null @@ -1,63 +0,0 @@ -configureRateLimiting(); - - $this->routes(function () { - Route::prefix('api') - ->middleware('api') - ->namespace($this->namespace) - ->group(base_path('routes/api.php')); - - Route::middleware('web') - ->namespace($this->namespace) - ->group(base_path('routes/web.php')); - }); - } - - /** - * Configure the rate limiters for the application. - * - * @return void - */ - protected function configureRateLimiting() - { - RateLimiter::for('api', function (Request $request) { - return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); - }); - } -} diff --git a/src/database/seeders/DatabaseSeeder.php b/src/database/seeders/DatabaseSeeder.php deleted file mode 100644 index 71f673f..0000000 --- a/src/database/seeders/DatabaseSeeder.php +++ /dev/null @@ -1,19 +0,0 @@ -create(); - } -} diff --git a/src/init_repo.sh b/src/init_repo.sh deleted file mode 100644 index 5fef317..0000000 --- a/src/init_repo.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -# Navigate to your application directory -cd /var/www/htdoc - -# displays the current path, for debugging -# pwd - -# Check if the vendor directory does not exist -if [ ! -d "vendor" ]; then - # Run composer install - composer install - cp .env.example .env - php artisan key:generate -fi - -# Then, execute the main command, e.g., starting PHP-FPM -# exec php-fpm diff --git a/src/lang/en.json b/src/lang/en.json deleted file mode 100644 index 577680d..0000000 --- a/src/lang/en.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "The :attribute must contain at least one letter.": "The :attribute must contain at least one letter.", - "The :attribute must contain at least one number.": "The :attribute must contain at least one number.", - "The :attribute must contain at least one symbol.": "The :attribute must contain at least one symbol.", - "The :attribute must contain at least one uppercase and one lowercase letter.": "The :attribute must contain at least one uppercase and one lowercase letter.", - "The given :attribute has appeared in a data leak. Please choose a different :attribute.": "The given :attribute has appeared in a data leak. Please choose a different :attribute." -} diff --git a/src/lang/en/auth.php b/src/lang/en/auth.php deleted file mode 100644 index 6598e2c..0000000 --- a/src/lang/en/auth.php +++ /dev/null @@ -1,20 +0,0 @@ - 'These credentials do not match our records.', - 'password' => 'The provided password is incorrect.', - 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', - -]; diff --git a/src/lang/en/pagination.php b/src/lang/en/pagination.php deleted file mode 100644 index d481411..0000000 --- a/src/lang/en/pagination.php +++ /dev/null @@ -1,19 +0,0 @@ - '« Previous', - 'next' => 'Next »', - -]; diff --git a/src/lang/en/passwords.php b/src/lang/en/passwords.php deleted file mode 100644 index 2345a56..0000000 --- a/src/lang/en/passwords.php +++ /dev/null @@ -1,22 +0,0 @@ - 'Your password has been reset!', - 'sent' => 'We have emailed your password reset link!', - 'throttled' => 'Please wait before retrying.', - 'token' => 'This password reset token is invalid.', - 'user' => "We can't find a user with that email address.", - -]; diff --git a/src/lang/en/validation.php b/src/lang/en/validation.php deleted file mode 100644 index 783003c..0000000 --- a/src/lang/en/validation.php +++ /dev/null @@ -1,163 +0,0 @@ - 'The :attribute must be accepted.', - 'accepted_if' => 'The :attribute must be accepted when :other is :value.', - 'active_url' => 'The :attribute is not a valid URL.', - 'after' => 'The :attribute must be a date after :date.', - 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', - 'alpha' => 'The :attribute must only contain letters.', - 'alpha_dash' => 'The :attribute must only contain letters, numbers, dashes and underscores.', - 'alpha_num' => 'The :attribute must only contain letters and numbers.', - 'array' => 'The :attribute must be an array.', - 'before' => 'The :attribute must be a date before :date.', - 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', - 'between' => [ - 'numeric' => 'The :attribute must be between :min and :max.', - 'file' => 'The :attribute must be between :min and :max kilobytes.', - 'string' => 'The :attribute must be between :min and :max characters.', - 'array' => 'The :attribute must have between :min and :max items.', - ], - 'boolean' => 'The :attribute field must be true or false.', - 'confirmed' => 'The :attribute confirmation does not match.', - 'current_password' => 'The password is incorrect.', - 'date' => 'The :attribute is not a valid date.', - 'date_equals' => 'The :attribute must be a date equal to :date.', - 'date_format' => 'The :attribute does not match the format :format.', - 'declined' => 'The :attribute must be declined.', - 'declined_if' => 'The :attribute must be declined when :other is :value.', - 'different' => 'The :attribute and :other must be different.', - 'digits' => 'The :attribute must be :digits digits.', - 'digits_between' => 'The :attribute must be between :min and :max digits.', - 'dimensions' => 'The :attribute has invalid image dimensions.', - 'distinct' => 'The :attribute field has a duplicate value.', - 'email' => 'The :attribute must be a valid email address.', - 'ends_with' => 'The :attribute must end with one of the following: :values.', - 'enum' => 'The selected :attribute is invalid.', - 'exists' => 'The selected :attribute is invalid.', - 'file' => 'The :attribute must be a file.', - 'filled' => 'The :attribute field must have a value.', - 'gt' => [ - 'numeric' => 'The :attribute must be greater than :value.', - 'file' => 'The :attribute must be greater than :value kilobytes.', - 'string' => 'The :attribute must be greater than :value characters.', - 'array' => 'The :attribute must have more than :value items.', - ], - 'gte' => [ - 'numeric' => 'The :attribute must be greater than or equal to :value.', - 'file' => 'The :attribute must be greater than or equal to :value kilobytes.', - 'string' => 'The :attribute must be greater than or equal to :value characters.', - 'array' => 'The :attribute must have :value items or more.', - ], - 'image' => 'The :attribute must be an image.', - 'in' => 'The selected :attribute is invalid.', - 'in_array' => 'The :attribute field does not exist in :other.', - 'integer' => 'The :attribute must be an integer.', - 'ip' => 'The :attribute must be a valid IP address.', - 'ipv4' => 'The :attribute must be a valid IPv4 address.', - 'ipv6' => 'The :attribute must be a valid IPv6 address.', - 'json' => 'The :attribute must be a valid JSON string.', - 'lt' => [ - 'numeric' => 'The :attribute must be less than :value.', - 'file' => 'The :attribute must be less than :value kilobytes.', - 'string' => 'The :attribute must be less than :value characters.', - 'array' => 'The :attribute must have less than :value items.', - ], - 'lte' => [ - 'numeric' => 'The :attribute must be less than or equal to :value.', - 'file' => 'The :attribute must be less than or equal to :value kilobytes.', - 'string' => 'The :attribute must be less than or equal to :value characters.', - 'array' => 'The :attribute must not have more than :value items.', - ], - 'mac_address' => 'The :attribute must be a valid MAC address.', - 'max' => [ - 'numeric' => 'The :attribute must not be greater than :max.', - 'file' => 'The :attribute must not be greater than :max kilobytes.', - 'string' => 'The :attribute must not be greater than :max characters.', - 'array' => 'The :attribute must not have more than :max items.', - ], - 'mimes' => 'The :attribute must be a file of type: :values.', - 'mimetypes' => 'The :attribute must be a file of type: :values.', - 'min' => [ - 'numeric' => 'The :attribute must be at least :min.', - 'file' => 'The :attribute must be at least :min kilobytes.', - 'string' => 'The :attribute must be at least :min characters.', - 'array' => 'The :attribute must have at least :min items.', - ], - 'multiple_of' => 'The :attribute must be a multiple of :value.', - 'not_in' => 'The selected :attribute is invalid.', - 'not_regex' => 'The :attribute format is invalid.', - 'numeric' => 'The :attribute must be a number.', - 'password' => 'The password is incorrect.', - 'present' => 'The :attribute field must be present.', - 'prohibited' => 'The :attribute field is prohibited.', - 'prohibited_if' => 'The :attribute field is prohibited when :other is :value.', - 'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.', - 'prohibits' => 'The :attribute field prohibits :other from being present.', - 'regex' => 'The :attribute format is invalid.', - 'required' => 'The :attribute field is required.', - 'required_array_keys' => 'The :attribute field must contain entries for: :values.', - 'required_if' => 'The :attribute field is required when :other is :value.', - 'required_unless' => 'The :attribute field is required unless :other is in :values.', - 'required_with' => 'The :attribute field is required when :values is present.', - 'required_with_all' => 'The :attribute field is required when :values are present.', - 'required_without' => 'The :attribute field is required when :values is not present.', - 'required_without_all' => 'The :attribute field is required when none of :values are present.', - 'same' => 'The :attribute and :other must match.', - 'size' => [ - 'numeric' => 'The :attribute must be :size.', - 'file' => 'The :attribute must be :size kilobytes.', - 'string' => 'The :attribute must be :size characters.', - 'array' => 'The :attribute must contain :size items.', - ], - 'starts_with' => 'The :attribute must start with one of the following: :values.', - 'string' => 'The :attribute must be a string.', - 'timezone' => 'The :attribute must be a valid timezone.', - 'unique' => 'The :attribute has already been taken.', - 'uploaded' => 'The :attribute failed to upload.', - 'url' => 'The :attribute must be a valid URL.', - 'uuid' => 'The :attribute must be a valid UUID.', - - /* - |-------------------------------------------------------------------------- - | Custom Validation Language Lines - |-------------------------------------------------------------------------- - | - | Here you may specify custom validation messages for attributes using the - | convention "attribute.rule" to name the lines. This makes it quick to - | specify a specific custom language line for a given attribute rule. - | - */ - - 'custom' => [ - 'attribute-name' => [ - 'rule-name' => 'custom-message', - ], - ], - - /* - |-------------------------------------------------------------------------- - | Custom Validation Attributes - |-------------------------------------------------------------------------- - | - | The following language lines are used to swap our attribute placeholder - | with something more reader friendly such as "E-Mail Address" instead - | of "email". This simply helps us make our message more expressive. - | - */ - - 'attributes' => [], - -]; diff --git a/src/package.json b/src/package.json deleted file mode 100644 index 7a9aecd..0000000 --- a/src/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "private": true, - "scripts": { - "dev": "npm run development", - "development": "mix", - "watch": "mix watch", - "watch-poll": "mix watch -- --watch-options-poll=1000", - "hot": "mix watch --hot", - "prod": "npm run production", - "production": "mix --production" - }, - "devDependencies": { - "axios": "^0.25", - "laravel-mix": "^6.0.6", - "lodash": "^4.17.19", - "postcss": "^8.1.14" - } -} diff --git a/src/resources/js/app.js b/src/resources/js/app.js deleted file mode 100644 index 40c55f6..0000000 --- a/src/resources/js/app.js +++ /dev/null @@ -1 +0,0 @@ -require('./bootstrap'); diff --git a/src/resources/views/post.blade.php b/src/resources/views/post.blade.php deleted file mode 100644 index 4f47dd2..0000000 --- a/src/resources/views/post.blade.php +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - Post Page - - -

{{$post_data->post_title}}

- - -
{!! $post_data->post_content !!}
- -
{{ $post_data->mdb_post_date }}
- - -
First Taxonomy: {{ $post_data->mdb_post_taxonomies[0]['name'] }}
- -
RAW Object: {{$post_data}}
- - \ No newline at end of file diff --git a/src/resources/views/welcome.blade.php b/src/resources/views/welcome.blade.php deleted file mode 100644 index dd6a45d..0000000 --- a/src/resources/views/welcome.blade.php +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - Laravel - - - - - - - - - - -
- @if (Route::has('login')) - - @endif - -
-
- - - - - -
- -
-
-
- - -
-
- Laravel has wonderful, thorough documentation covering every aspect of the framework. Whether you are new to the framework or have previous experience with Laravel, we recommend reading all of the documentation from beginning to end. -
-
-
- -
-
- - -
- -
-
- Laracasts offers thousands of video tutorials on Laravel, PHP, and JavaScript development. Check them out, see for yourself, and massively level up your development skills in the process. -
-
-
- -
-
- - -
- -
-
- Laravel News is a community driven portal and newsletter aggregating all of the latest and most important news in the Laravel ecosystem, including new package releases and tutorials. -
-
-
- -
-
- -
Vibrant Ecosystem
-
- -
-
- Laravel's robust library of first-party tools and libraries, such as Forge, Vapor, Nova, and Envoyer help you take your projects to the next level. Pair them with powerful open source libraries like Cashier, Dusk, Echo, Horizon, Sanctum, Telescope, and more. -
-
-
-
-
- -
-
-
- - - - - - Shop - - - - - - - - Sponsor - -
-
- -
- Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }}) -
-
-
-
- - diff --git a/src/routes/web.php b/src/routes/web.php deleted file mode 100644 index 3873750..0000000 --- a/src/routes/web.php +++ /dev/null @@ -1,34 +0,0 @@ - Date: Mon, 18 Sep 2023 10:39:14 -0700 Subject: [PATCH 03/11] Update README.md --- README.md | 132 +++--------------------------------------------------- 1 file changed, 6 insertions(+), 126 deletions(-) diff --git a/README.md b/README.md index a6d519d..7d47c6c 100644 --- a/README.md +++ b/README.md @@ -1,127 +1,7 @@ -# How To Build a Laravel + MongoDB Back End Service +## About this repository -This code was written to accompany [this tutorial article](https://www.mongodb.com/developer/languages/php/laravel-mongodb-tutorial/?utm_campaign=devrel). - -## Prerequisites -You'll need the following installed on your computer to follow along with this tutorial: - -- A MongoDB Atlas cluster - - [Create a **free** cluster](https://www.mongodb.com/try?utm_campaign=devrel) and [load the MongoDB sample data](https://www.mongodb.com/basics/sample-database?utm_campaign=devrel). -- A GitHub account if you want to use GitHub Codespaces (a 1-click experience) - - The `master` repo has all the code, but we also have a `starter` branch if you want to follow the project from scratch and build the migrations etc. -- A code editor of your choice for local development - - We suggeest [Visual Studio Code](https://code.visualstudio.com/download). Check the optional [MongoDB for VS Code](https://www.mongodb.com/products/vs-code?utm_campaign=devrel) extension. - -The article mentions several ways to get a Laravel development environment up and running. - -# 🚀 Launch this repo in CodeSpaces - - - -⏳Codespaces will build the app's container(s). This may take **~3 minutes**. - - - -✅Done! We now have our project running inside CodeSpaces. We can proceed to setting up Laravel - - - -

- -# 👋 Before you run this Laravel app - -## 1. Final Laravel app setup - -After cloning the code repo or launching a Docker/CodeSpaces instance, a script called `init_repo.sh` will be automatically executed (as setup in devcontainer.json) to: - -- install dependencies via Composer -- create a new .env file -- generate a new Laravel App Key - -1. All you need to do is to **add your MongoDB credentials in Laravel's .env file**, using the MONGODB_URI environment variable. Here's [how to get your credentials](https://www.mongodb.com/docs/guides/atlas/connection-string/?utm_campaign=devrel) It looks something like this: - -``` -MONGODB_URI=mongodb+srv://USERNAME:PASSWORD@clustername.subdomain.mongodb.net/?retryWrites=true&w=majority -``` - -❗Note that this branch already has the Laravel Model and Migrations already created and ready, but the tables have been initialized yet. - -2. You can test your credentials by using the code's API endpoint - -``` -/api/ping/ -``` - -Find the site's root URL by going to the "Ports" tab and click on the globe icon of port 80 - - - -3. If the MongoDB ping test worked, use this command in the terminal to initialize the tables - -`php artisan migrate:refresh` - -

- -## 2. Ready! - - - -Our base Laravel app is ready 🥳. - -**Next**, try some of the things we talked about in our [How To Build a Laravel + MongoDB Back End Service](https://www.mongodb.com/developer/languages/php/laravel-mongodb-tutorial/) - -# 🚀 Launch locally with Docker - -Assuming that you already have Docker Desktop installed on Windows/Mac or Docker on Linux, - -- clone the repository to a local directory -- navigate to the ./devcontainer folder -- execute `docker compose up` -- in the PHP container, execute `sh init_repo.sh` -- initialize your .env file as instructed above - -Once the container(s) are up, visit http://localhost - -# Optional: Xdebug - -The xdebug.php-debug VS Code extension is automatically installed if you launch via devcontainer.json. - -👀 **Important**: our `.devcontainer/.docker/php/xdebug.ini` file is setup by default with `xdebug.client_host=localhost`, which should works for **CodeSpaces** and Devcontainers. - -For **local development**, you need to replace `localhost` with the IP where your code IDE runs or a dns name that maps to it. That's because your PHP container and the IDE host tend to have different IPs. - -If you are using our container directly (docker compose up), or via VS Code (devcontainer), we suggest the following Xdebug configs visual studio. Note the difference in path mapping. - -## CodeSpaces and (inside a Devcontainer) - -```json -{ - "name": "Listen for Xdebug", - "type": "php", - "request": "launch", - "port": 9003, - "pathMappings": { - "/var/www/htdoc": "${workspaceFolder}" - } -}, -``` - -## local development with Docker - -The debug config file is located in `/.vscode/launch.json` - -```json -{ - "name": "Listen for Xdebug", - "type": "php", - "request": "launch", - "port": 9003, - "pathMappings": { - "/var/www/htdoc": "${workspaceFolder}/src" - } -}, -``` - -# Disclaimer - -Use at your own risk; not a supported MongoDB product +- A clean Laravel 10 project created with `composer create-project laravel/laravel` +- no extra package added yet +- designed to run in CodeSpaces or Docker via `\.devcontainer\` with `docker compuse up` +- directory structure friendly to Wilco via the `\.framework\` directory +- NGINX serves the public web folder located at `\.framework\php\src\public\` From aae5b58ddaa0fb9fcd754789bc6fb7d2a3d7ef2f Mon Sep 17 00:00:00 2001 From: Hubert Nguyen Date: Mon, 18 Sep 2023 11:25:05 -0700 Subject: [PATCH 04/11] add init_repo.sh this makes it easier to get up and running inside CodeSpaces it is expected by our current devcontainer.json and was deleted when we re-initialized the Laravel app to a clean install --- .devcontainer/devcontainer.json | 2 +- .framework/php/src/init_repo.sh | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 .framework/php/src/init_repo.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 920ab7d..f60d594 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,5 +1,5 @@ { - "name": "laravel-mongodb-tutorial", + "name": "laravel-fresh-install", // Mandatory definition for .devcontainer // diff --git a/.framework/php/src/init_repo.sh b/.framework/php/src/init_repo.sh new file mode 100644 index 0000000..93d18a1 --- /dev/null +++ b/.framework/php/src/init_repo.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +# Navigate to your application directory +cd /var/www/htdoc + +# displays the current path, for debugging +# pwd + +# Check if the vendor directory does not exist +if [ ! -d "vendor" ]; then + # Run composer install + composer install + cp .env.example .env + php artisan key:generate +fi + +# Then, execute the main command, e.g., starting PHP-FPM +# exec php-fpm \ No newline at end of file From a799b5bce9ee92ddc0a99eb8a61380a7154ace35 Mon Sep 17 00:00:00 2001 From: Hubert Nguyen Date: Tue, 19 Sep 2023 10:54:41 -0700 Subject: [PATCH 05/11] Create quest.yml adding this mandatory file to have a wilco-compatible as a starting point --- quest.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 quest.yml diff --git a/quest.yml b/quest.yml new file mode 100644 index 0000000..277abc5 --- /dev/null +++ b/quest.yml @@ -0,0 +1,4 @@ +repository: https://github.com/trywilco/laravel-mongodb-tutorial-base +frameworks: + backend: + - php \ No newline at end of file From 494fd475b05d08854abf61ffa691c3271b792280 Mon Sep 17 00:00:00 2001 From: Eti Noked <42963541+EtiNoked@users.noreply.github.com> Date: Thu, 21 Sep 2023 19:07:01 +0300 Subject: [PATCH 06/11] Update .env --- .devcontainer/.env | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/.env b/.devcontainer/.env index 4248e91..5a8ff71 100644 --- a/.devcontainer/.env +++ b/.devcontainer/.env @@ -6,7 +6,7 @@ NGINX_CONTAINER_PORT=80 NGINX_HOST_CONFD_DIR=./.docker/nginx/conf.d NGINX_CONTAINER_CONFD_DIR=/etc/nginx/conf.d -PHP_WEBROOT_HOST_PATH=../.framework/php/src/ +PHP_WEBROOT_HOST_PATH=../src/ PHP_WEBROOT_CONTAINER_PATH=/var/www/htdoc NGINX_WEBROOT_HOST_PATH=../src/ @@ -25,4 +25,4 @@ PHP_IMAGE=php:8.2-fpm REDIS_DATA_HOST_PATH=./data/redis -REDIS_DATA_CONTAINER_PATH=/etc/data \ No newline at end of file +REDIS_DATA_CONTAINER_PATH=/etc/data From 08bb978d6d7fcda86667ae450766cde704d093f2 Mon Sep 17 00:00:00 2001 From: Shem Date: Tue, 3 Oct 2023 17:56:31 +0300 Subject: [PATCH 07/11] Update devcontainer.json --- .devcontainer/devcontainer.json | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f60d594..153526f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,21 +1,6 @@ { "name": "laravel-fresh-install", - // Mandatory definition for .devcontainer - // - // which service AS DEFINED IN .devcontainer/docker-compose.yml - // do we want VS Code to attach to? - // here, we choose the "php" service since that's where our code is executed - "service": "php", - - // we have multiple containers (nginx, PHP, MySQL, redis) - // so we'll use a compose .yml file instead of defining the services in devcontainer.json - "dockerComposeFile": "./docker-compose.yml", - - "shutdownAction": "stopCompose", - - // Mandatory definition for .devcontainer - // // workspaceFolder describes the CONTAINER folder // in which the "service" (php here) is configured to mount the project // in our case, "/var/www/htdoc" refers to @@ -45,4 +30,4 @@ // execute our one-time repo init if /vendor/ does not exist "postCreateCommand": "sh init_repo.sh" -} \ No newline at end of file +} From a38564b5e1d528f307337774656fa8329697d8f5 Mon Sep 17 00:00:00 2001 From: Shem Date: Tue, 3 Oct 2023 17:57:50 +0300 Subject: [PATCH 08/11] Update and rename .devcontainer/docker-compose.yml to .framework/php/docker-compose.yml --- .devcontainer/docker-compose.yml | 84 ------------------------------- .framework/php/docker-compose.yml | 62 +++++++++++++++++++++++ 2 files changed, 62 insertions(+), 84 deletions(-) delete mode 100644 .devcontainer/docker-compose.yml create mode 100644 .framework/php/docker-compose.yml diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml deleted file mode 100644 index 6f4bdf4..0000000 --- a/.devcontainer/docker-compose.yml +++ /dev/null @@ -1,84 +0,0 @@ -# build command: docker compose build -# docker uses the .env file BY DEFAULT. Any other name and you'll have to specify it in the command line -# docker compose --env-file FILENAME.env build - -# docker compose version -version: '3.4' - -# Services -services: - - # Nginx Service - nginx: - - image: ${NGINX_IMAGE} - ports: - - ${NGINX_HOST_PORT}:${NGINX_CONTAINER_PORT} - - # path is relative to where the docker-compose.yml file is. - # local-path : container-path - # - volumes: - # public web files - - ${NGINX_WEBROOT_HOST_PATH}:${NGINX_WEBROOT_CONTAINER_PATH} - # .ini location - - ${NGINX_HOST_CONFD_DIR}:${NGINX_CONTAINER_CONFD_DIR} - depends_on: - - php - - mysql_service - - # PHP Service - php: - build: - context: ./.docker/php - dockerfile: Dockerfile - args: - RUNTIME_PHP_IMAGE: ${PHP_IMAGE} - image: ${PHP_IMAGE} - # container-path - working_dir: ${PHP_WEBROOT_CONTAINER_PATH} - # disk local-path - volumes: - - ${PHP_WEBROOT_HOST_PATH}:${PHP_WEBROOT_CONTAINER_PATH} - # we don't need to expose the port 9003 here for Xdebug because the - # connection comes from inside the PHP container to the IDE via port 9003 - environment: - # laravel's default mysql config looks for the DATABASE_URL environment variable - - DATABASE_URL=mysql://root:${MYSQL_ROOT_PASSWORD}@mysql_service:3306/${MYSQL_DATABASE} - depends_on: - - mysql_service - - # MySQL Service - mysql_service: - image: ${MYSQL_IMAGE} - - environment: - MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} - MYSQL_DATABASE: ${MYSQL_DATABASE} - - # the two variales below don't seem to be used at all. Commenting out for now - #MYSQL_USER: myuser - #MYSQL_PASSWORD: mypassword - - # do NOT try mounting a volume in CodeSpaces as it will fail and MySQL will not launch (try pinging mysql_service) - # this is only useful when working locally on a website with a non-ephemeral database - #volumes: - # map local /data/ folder to container /var/lib/mysql for MySQL data persistence - # - ${MYSQL_DATA_HOST_PATH}:${MYSQL_DATA_CONTAINER_PATH} - - ports: - - "3306:3306" - # syntax = host_port:container_port - - -# redis: -# image: redis:latest -# ports: -# - "6379:6379" -# volumes: -# - ${REDIS_DATA_HOST_PATH}:${REDIS_DATA_CONTAINER_PATH} - -# Notes: -# -# From Docker Compose version 3.4 the name of the volume can be dynamically generated from environment variables placed in an .env file (this file has to be in the same folder as docker-compose.yml is). -# diff --git a/.framework/php/docker-compose.yml b/.framework/php/docker-compose.yml new file mode 100644 index 0000000..86c41fe --- /dev/null +++ b/.framework/php/docker-compose.yml @@ -0,0 +1,62 @@ +# build command: docker compose build +# docker uses the .env file BY DEFAULT. Any other name and you'll have to specify it in the command line +# docker compose --env-file FILENAME.env build + +# docker compose version +version: '3.4' + +# Services +services: + + # Nginx Service + nginx: + + image: nginx:alpine + ports: + - 80:80 + volumes: + - ./src:/var/www/htdoc + - ./.docker/nginx/conf.d:/etc/nginx/conf.d + depends_on: + - php + - mysql_service + + # PHP Service + php: + build: + context: ./.docker/php + dockerfile: Dockerfile + args: + RUNTIME_PHP_IMAGE: php:8.2-fpm + image: php:8.2-fpm + # container-path + working_dir: /var/www/htdoc + volumes: + - ./src:/var/www/htdoc + environment: + - DATABASE_URL=mysql://root:rootpassword@mysql_service:3306/mydatabase + depends_on: + - mysql_service + + + + # MySQL Service + mysql_service: + image: mysql:5.7 + + environment: + MYSQL_ROOT_PASSWORD: rootpassword + MYSQL_DATABASE: mydatabase + + +# redis: +# image: redis:latest +# ports: +# - "6379:6379" +# volumes: +# - ${REDIS_DATA_HOST_PATH}:${REDIS_DATA_CONTAINER_PATH} + +# Notes: +# +# From Docker Compose version 3.4 the name of the volume can be dynamically generated from environment variables placed in an .env file (this file has to be in the same folder as docker-compose.yml is). +# From ac9eca61adce12d126d379758c4fb3c00675b38b Mon Sep 17 00:00:00 2001 From: Shem Date: Tue, 3 Oct 2023 17:58:06 +0300 Subject: [PATCH 09/11] Delete .devcontainer/.env --- .devcontainer/.env | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 .devcontainer/.env diff --git a/.devcontainer/.env b/.devcontainer/.env deleted file mode 100644 index 5a8ff71..0000000 --- a/.devcontainer/.env +++ /dev/null @@ -1,28 +0,0 @@ -# PATHs are relative to docker-compose.yml - -NGINX_IMAGE=nginx:alpine -NGINX_HOST_PORT=80 -NGINX_CONTAINER_PORT=80 -NGINX_HOST_CONFD_DIR=./.docker/nginx/conf.d -NGINX_CONTAINER_CONFD_DIR=/etc/nginx/conf.d - -PHP_WEBROOT_HOST_PATH=../src/ -PHP_WEBROOT_CONTAINER_PATH=/var/www/htdoc - -NGINX_WEBROOT_HOST_PATH=../src/ -NGINX_WEBROOT_CONTAINER_PATH=/var/www/htdoc - -MYSQL_IMAGE=mysql:5.7 -MYSQL_DATA_HOST_PATH=./data/mysql -MYSQL_DATA_CONTAINER_PATH=/var/lib/mysql -MYSQL_HOST_PORT=3306 -MYSQL_CONTAINER_PORT=3306 - -MYSQL_ROOT_PASSWORD=rootpassword -MYSQL_DATABASE=mydatabase - -PHP_IMAGE=php:8.2-fpm - - -REDIS_DATA_HOST_PATH=./data/redis -REDIS_DATA_CONTAINER_PATH=/etc/data From ad04ffd3a38498418bbcb5052b34405dce07b29c Mon Sep 17 00:00:00 2001 From: Shem Date: Tue, 3 Oct 2023 18:00:01 +0300 Subject: [PATCH 10/11] Update devcontainer.json --- .devcontainer/devcontainer.json | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 153526f..bf214b3 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,22 +1,6 @@ { "name": "laravel-fresh-install", - // workspaceFolder describes the CONTAINER folder - // in which the "service" (php here) is configured to mount the project - // in our case, "/var/www/htdoc" refers to - // ${WEBROOT_HOST_PATH}:${WEBROOT_CONTAINER_PATH} in our "php" service "volumeS" - // these are defined in .devcontainer/.env as follows: - // WEBROOT_HOST_PATH=../src - // WEBROOT_CONTAINER_PATH=/var/www/htdoc - "workspaceFolder": "/var/www/htdoc", - - // NOT REQUIRED, because our mounts are defined in the .yml file - // - // mount defined in docker-compose.yml - //"mounts": [ - // "source=${localWorkspaceFolder},target=/src,type=bind" - //], - // "xdebug.php-debug" = official XDEBUG extension "customizations": { "vscode": { From 6cd40c56900ef5f5a56c0e3980eb18f96ac7d04c Mon Sep 17 00:00:00 2001 From: Shem Date: Tue, 3 Oct 2023 15:01:26 +0000 Subject: [PATCH 11/11] fix docker file --- .devcontainer/.docker/php/Dockerfile | 71 ------------------- .../nginx/conf.d/error_reporting.ini | 0 .../nginx/conf.d/nginx-webserver.conf | 0 .docker/php/Dockerfile | 26 +++++++ .../.docker => .docker}/php/docker-php.ini | 0 .../.docker => .docker}/php/xdebug.ini | 0 6 files changed, 26 insertions(+), 71 deletions(-) delete mode 100644 .devcontainer/.docker/php/Dockerfile rename {.devcontainer/.docker => .docker}/nginx/conf.d/error_reporting.ini (100%) rename {.devcontainer/.docker => .docker}/nginx/conf.d/nginx-webserver.conf (100%) create mode 100644 .docker/php/Dockerfile rename {.devcontainer/.docker => .docker}/php/docker-php.ini (100%) rename {.devcontainer/.docker => .docker}/php/xdebug.ini (100%) diff --git a/.devcontainer/.docker/php/Dockerfile b/.devcontainer/.docker/php/Dockerfile deleted file mode 100644 index 69265a0..0000000 --- a/.devcontainer/.docker/php/Dockerfile +++ /dev/null @@ -1,71 +0,0 @@ -# defined in docker-compose.yml, from docker-env.env -ARG RUNTIME_PHP_IMAGE - -# Use the specified image as the base -FROM ${RUNTIME_PHP_IMAGE} - -# create the log file and provide permission to the www-data user -RUN touch /tmp/xdebug.log && chown www-data:www-data /tmp/xdebug.log - -# same thing for the PHP error log -RUN touch /var/log/php-errors.log && chown www-data:www-data /var/log/php-errors.log - -# Update the packages -# Install system packages required for MongoDB extension -# 'mysql-client' so we can log into mysql from the PHP container with the command 'mysql -h mysql -u root -p' where mysql is the service name -# 'iputils-ping' to get the ping command -RUN apt-get update \ - && apt-get install -y libssl-dev wget git unzip default-mysql-client iputils-ping - -RUN pecl apt update \ - && apt install libzip-dev -y \ - && docker-php-ext-install zip \ - && rm -rf /var/lib/apt/lists/* - -# Required for MySQL to work in PHP -RUN docker-php-ext-install mysqli && \ - docker-php-ext-install pdo_mysql - -# Test if already installed and -# install the mongodb PHP extension -# RUN pecl install mongodb && docker-php-ext-enable mongodb -RUN bash -c '[[ -n "$(pecl list | grep mongodb)" ]]\ - || (pecl install mongodb && docker-php-ext-enable mongodb)' - -# Test if already installed and -# install and enable XDEBUG -# RUN pecl install xdebug && docker-php-ext-enable xdebug -RUN bash -c '[[ -n "$(pecl list | grep xdebug)" ]]\ - || (pecl install xdebug && docker-php-ext-enable xdebug)' - -# install Redis PHP driver -RUN pecl install -o -f redis \ -&& rm -rf /tmp/pear \ -&& docker-php-ext-enable redis \ -&& docker-php-ext-enable pdo_mysql - -# Task: copy rep's PHP .ini files to be automatically parsed -# -# directory is related to the PHP service context -# dot NOT use ./filename.ext for root files -# use filename.ext -COPY docker-php.ini /usr/local/etc/php/conf.d/ -COPY xdebug.ini /usr/local/etc/php/conf.d/ - -# Install Composer -# ---------------------------------------------------------- -# download composer -RUN curl -sS https://getcomposer.org/installer | php -# copy composer to a place where it can be globally executed -RUN mv composer.phar /usr/local/bin/composer - -# our repo is in var/www/htdoc -# COPY init_repo.sh /var/www/htdoc/ - -# Set the working directory in the container -WORKDIR /var/www/htdoc - -# start out script that runs composer install, but ONLY if /vendor/ does not exist -# WARNING: the commands below crash CodeSpaces. Not using for now. -#RUN chmod +x /var/www/htdoc/init_repo.sh -#ENTRYPOINT ["/var/www/htdoc/init_repo.sh"] \ No newline at end of file diff --git a/.devcontainer/.docker/nginx/conf.d/error_reporting.ini b/.docker/nginx/conf.d/error_reporting.ini similarity index 100% rename from .devcontainer/.docker/nginx/conf.d/error_reporting.ini rename to .docker/nginx/conf.d/error_reporting.ini diff --git a/.devcontainer/.docker/nginx/conf.d/nginx-webserver.conf b/.docker/nginx/conf.d/nginx-webserver.conf similarity index 100% rename from .devcontainer/.docker/nginx/conf.d/nginx-webserver.conf rename to .docker/nginx/conf.d/nginx-webserver.conf diff --git a/.docker/php/Dockerfile b/.docker/php/Dockerfile new file mode 100644 index 0000000..1e86d9c --- /dev/null +++ b/.docker/php/Dockerfile @@ -0,0 +1,26 @@ +# defined in docker-compose.yml, from docker-env.env +ARG RUNTIME_PHP_IMAGE + +# Use the specified image as the base +FROM ${RUNTIME_PHP_IMAGE} + +# Install system dependencies and PHP extensions +RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libfreetype6-dev zip git unzip && \ + docker-php-ext-configure gd --with-freetype --with-jpeg && \ + docker-php-ext-install gd pdo pdo_mysql + +# Test if already installed and +# install the mongodb PHP extension +# RUN pecl install mongodb && docker-php-ext-enable mongodb +RUN bash -c '[[ -n "$(pecl list | grep mongodb)" ]]\ + || (pecl install mongodb && docker-php-ext-enable mongodb)' + +# Test if already installed and +# install and enable XDEBUG +# RUN pecl install xdebug && docker-php-ext-enable xdebug +RUN bash -c '[[ -n "$(pecl list | grep xdebug)" ]]\ + || (pecl install xdebug && docker-php-ext-enable xdebug)' +# Get Composer +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer + +WORKDIR /var/www/htdoc \ No newline at end of file diff --git a/.devcontainer/.docker/php/docker-php.ini b/.docker/php/docker-php.ini similarity index 100% rename from .devcontainer/.docker/php/docker-php.ini rename to .docker/php/docker-php.ini diff --git a/.devcontainer/.docker/php/xdebug.ini b/.docker/php/xdebug.ini similarity index 100% rename from .devcontainer/.docker/php/xdebug.ini rename to .docker/php/xdebug.ini