PHP Classes

How to Implement a PHP E-commerce Website Using Laravel with the Package Laravel Simple E-commerce: Show and sell products on a Web site

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-12-15 (Yesterday) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
laravel-simple-ecomm 1.0.0The PHP License7E-Commerce, Libraries, Web services, P...
Description 

Author

This package can show and sell products on a Web site.

It provides a Web application and an API to retrieve products for sale and process sales of those products.

Currently, it can:

- Process user registration and login

- Retrieve lists of products or individual products available for sale.

- Add, update, list, and remove products to a shopping cart

- List, view, and update product orders

Picture of Hicri
  Performance   Level  
Name: Hicri <contact>
Classes: 30 packages by
Country: Turkey Turkey
Innovation award
Innovation award
Nominee: 4x

Winner: 1x

Example

<?php

use Illuminate\Http\Request;
use
Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "api" middleware group. Make something great!
|
*/

//Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
// return $request->user();
//});
Route::post('/auth/login',[\App\Http\Controllers\Auth\LoginController::class, 'login'])->name('login');
Route::post('/auth/register',[\App\Http\Controllers\Auth\RegisterController::class, 'store']);

Route::group(['middleware' => 'auth:api'], function ($router) {

   
Route::post('/auth/logout',[\App\Http\Controllers\Auth\LogoutController::class, 'logout'])->middleware('throttle:30,1');
   
Route::post('/auth/refresh',[\App\Http\Controllers\Auth\LoginController::class, 'refresh'])->middleware('throttle:30,1');

   
Route::get('/products', [\App\Http\Controllers\ProductController::class, 'index'])->middleware('throttle:30,1');
   
Route::get('/products/{id}', [\App\Http\Controllers\ProductController::class, 'show'])->where('id', '[0-9]+')->middleware('throttle:30,1');
   
Route::post('/products', [\App\Http\Controllers\ProductController::class, 'store'])->middleware('is_admin','throttle:30,1');
   
Route::put('/products/{id}', [\App\Http\Controllers\ProductController::class, 'update'])->where('id', '[0-9]+')->middleware('is_admin','throttle:30,1');
   
Route::delete('/products/{id}', [\App\Http\Controllers\ProductController::class, 'delete'])->where('id', '[0-9]+')->middleware('is_admin','throttle:30,1');

   
Route::get('/cart', [\App\Http\Controllers\CartController::class, 'index'])->middleware('throttle:30,1');
   
Route::post('/cart/items', [\App\Http\Controllers\CartController::class, 'store'])->middleware('throttle:30,1');
   
Route::put('/cart/items/{id}', [\App\Http\Controllers\CartItemController::class, 'update'])->where('id', '[0-9]+')->middleware('throttle:30,1');
   
Route::delete('/cart/items/{id}', [\App\Http\Controllers\CartItemController::class, 'delete'])->where('id', '[0-9]+')->middleware('throttle:30,1');

   
Route::get('/orders', [\App\Http\Controllers\OrderController::class, 'index'])->middleware('throttle:30,1');
   
Route::post('/orders', [\App\Http\Controllers\OrderController::class, 'store'])->middleware('throttle:30,1');
   
Route::get('/orders/{id}', [\App\Http\Controllers\OrderController::class, 'show'])->where('id', '[0-9]+')->middleware('throttle:30,1');

});



Details

Contents

PHP
Composer
Docker
MySQl
Redis
Jwt
Nginx
Testing
Rate limiting

Installation

docker compose up -d --build 
docker compose exec app bash
chmod -R 777 /var/www/html/storage/ /var/www/html/bootstrap/
cp .env.example .env
composer install
docker compose exec app php artisan jwt:secret
docker compose exec app php artisan migrate:fresh --seed

env config

  • mysql
    DB_CONNECTION=mysql
    DB_HOST=db
    DB_PORT=3306
    DB_DATABASE=laravel
    DB_USERNAME=laravel
    DB_PASSWORD=laravel
    
  • redis
    CACHE_DRIVER=redis
    REDIS_CLIENT=predis
    REDIS_HOST=redis
    REDIS_PASSWORD=null
    REDIS_PORT=6379
    
    ### Usage
    
    Insomnia_2024-12-13.json

Testing

cp .env .env.testing
docker-compose exec app php artisan config:clear
docker-compose exec app php artisan cache:clear
docker-compose exec app php artisan config:cache
docker-compose exec app php artisan migrate:fresh --seed --env=testing
docker-compose exec app php artisan test
  • env.testing
    APP_ENV=testing
    DB_CONNECTION=mysql
    DB_HOST=db
    DB_PORT=3306
    DB_DATABASE=laravel
    DB_USERNAME=laravel
    DB_PASSWORD=laravel
    

  Files folder image Files (133)  
File Role Description
Files folder imageapp (8 directories)
Files folder imagebootstrap (1 file)
Files folder imageconfig (16 files)
Files folder imagedatabase (3 directories)
Files folder imagedocker (2 directories)
Files folder imagepublic (3 files)
Files folder imageresources (2 directories)
Files folder imageroutes (4 files)
Files folder imagetests (2 files, 2 directories)
Accessible without login Plain text file .env.example Data Auxiliary data
Accessible without login Plain text file .env.testing Data Auxiliary data
Plain text file artisan Class Class source
Accessible without login Plain text file build.sh Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file docker-compose.yml Data Auxiliary data
Accessible without login Plain text file entrypoint.sh Data Auxiliary data
Accessible without login Plain text file Insomnia_2024-12-13.json Data Auxiliary data
Accessible without login Plain text file package.json Data Auxiliary data
Accessible without login Plain text file php.root.Dockerfile Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file vite.config.js Data Auxiliary data

  Files folder image Files (133)  /  app  
File Role Description
Files folder imageConsole (1 file)
Files folder imageEnums (3 files)
Files folder imageEvents (2 files)
Files folder imageExceptions (1 file)
Files folder imageHttp (1 file, 6 directories)
Files folder imageListeners (2 files)
Files folder imageModels (5 files, 1 directory)
Files folder imageProviders (6 files)

  Files folder image Files (133)  /  app  /  Console  
File Role Description
  Plain text file Kernel.php Class Class source

  Files folder image Files (133)  /  app  /  Enums  
File Role Description
  Accessible without login Plain text file CartStatus.php Aux. Configuration script
  Accessible without login Plain text file OrderStatus.php Aux. Configuration script
  Accessible without login Plain text file ProductStatus.php Aux. Configuration script

  Files folder image Files (133)  /  app  /  Events  
File Role Description
  Plain text file CartStatusEvent.php Class Class source
  Plain text file ProductStockEvent.php Class Class source

  Files folder image Files (133)  /  app  /  Exceptions  
File Role Description
  Plain text file Handler.php Class Class source

  Files folder image Files (133)  /  app  /  Http  
File Role Description
Files folder imageControllers (5 files, 1 directory)
Files folder imageMiddleware (10 files)
Files folder imageRepositories (5 directories)
Files folder imageRequests (7 files)
Files folder imageResources (6 files)
Files folder imageServices (5 files)
  Plain text file Kernel.php Class Class source

  Files folder image Files (133)  /  app  /  Http  /  Controllers  
File Role Description
Files folder imageAuth (3 files)
  Plain text file CartController.php Class Class source
  Plain text file CartItemController.php Class Class source
  Plain text file Controller.php Class Class source
  Plain text file OrderController.php Class Class source
  Plain text file ProductController.php Class Class source

  Files folder image Files (133)  /  app  /  Http  /  Controllers  /  Auth  
File Role Description
  Plain text file LoginController.php Class Class source
  Plain text file LogoutController.php Class Class source
  Plain text file RegisterController.php Class Class source

  Files folder image Files (133)  /  app  /  Http  /  Middleware  
File Role Description
  Plain text file Authenticate.php Class Class source
  Plain text file EncryptCookies.php Class Class source
  Plain text file IsAdminMiddleware.php Class Class source
  Plain text file PreventRequestsDuringMaintenance.php Class Class source
  Plain text file RedirectIfAuthenticated.php Class Class source
  Plain text file TrimStrings.php Class Class source
  Plain text file TrustHosts.php Class Class source
  Plain text file TrustProxies.php Class Class source
  Plain text file ValidateSignature.php Class Class source
  Plain text file VerifyCsrfToken.php Class Class source

  Files folder image Files (133)  /  app  /  Http  /  Repositories  
File Role Description
Files folder imageCart (2 files)
Files folder imageCartItem (2 files)
Files folder imageOrder (2 files)
Files folder imageProduct (2 files)
Files folder imageUser (2 files)

  Files folder image Files (133)  /  app  /  Http  /  Repositories  /  Cart  
File Role Description
  Plain text file CartRepository.php Class Class source
  Plain text file CartRepositoryInterface.php Class Class source

  Files folder image Files (133)  /  app  /  Http  /  Repositories  /  CartItem  
File Role Description
  Plain text file CartItemRepository.php Class Class source
  Plain text file CartItemRepositoryInterface.php Class Class source

  Files folder image Files (133)  /  app  /  Http  /  Repositories  /  Order  
File Role Description
  Plain text file OrderRepository.php Class Class source
  Plain text file OrderRepositoryInterface.php Class Class source

  Files folder image Files (133)  /  app  /  Http  /  Repositories  /  Product  
File Role Description
  Plain text file ProductRepository.php Class Class source
  Plain text file ProductRepositoryInterface.php Class Class source

  Files folder image Files (133)  /  app  /  Http  /  Repositories  /  User  
File Role Description
  Plain text file UserRepository.php Class Class source
  Plain text file UserRepositoryInterface.php Class Class source

  Files folder image Files (133)  /  app  /  Http  /  Requests  
File Role Description
  Plain text file CartItemUpdateRequest.php Class Class source
  Plain text file CartStoreRequest.php Class Class source
  Plain text file LoginRequest.php Class Class source
  Plain text file OrderStoreRequest.php Class Class source
  Plain text file ProductStoreRequest.php Class Class source
  Plain text file ProductUpdateRequest.php Class Class source
  Plain text file RegisterRequest.php Class Class source

  Files folder image Files (133)  /  app  /  Http  /  Resources  
File Role Description
  Plain text file CartResource.php Class Class source
  Plain text file OrderResource.php Class Class source
  Plain text file OrderShowResource.php Class Class source
  Plain text file ProductResource.php Class Class source
  Plain text file ProductShowResource.php Class Class source
  Plain text file ProductStoreResource.php Class Class source

  Files folder image Files (133)  /  app  /  Http  /  Services  
File Role Description
  Plain text file CartItemService.php Class Class source
  Plain text file CartService.php Class Class source
  Plain text file OrderService.php Class Class source
  Plain text file ProductService.php Class Class source
  Plain text file UserService.php Class Class source

  Files folder image Files (133)  /  app  /  Listeners  
File Role Description
  Plain text file CartStatusListener.php Class Class source
  Plain text file ProductStockListener.php Class Class source

  Files folder image Files (133)  /  app  /  Models  
File Role Description
Files folder imageTrait (1 file)
  Plain text file Cart.php Class Class source
  Plain text file CartItem.php Class Class source
  Plain text file Order.php Class Class source
  Plain text file Product.php Class Class source
  Plain text file User.php Class Class source

  Files folder image Files (133)  /  app  /  Models  /  Trait  
File Role Description
  Plain text file Sluggable.php Class Class source

  Files folder image Files (133)  /  app  /  Providers  
File Role Description
  Plain text file AppServiceProvider.php Class Class source
  Plain text file AuthServiceProvider.php Class Class source
  Plain text file BroadcastServiceProvider.php Class Class source
  Plain text file EventServiceProvider.php Class Class source
  Plain text file RepositoryServiceProvider.php Class Class source
  Plain text file RouteServiceProvider.php Class Class source

  Files folder image Files (133)  /  bootstrap  
File Role Description
  Plain text file app.php Class Class source

  Files folder image Files (133)  /  config  
File Role Description
  Plain text file app.php Class Class source
  Plain text file auth.php Class Class source
  Accessible without login Plain text file broadcasting.php Aux. Configuration script
  Accessible without login Plain text file cache.php Aux. Configuration script
  Accessible without login Plain text file cors.php Aux. Configuration script
  Accessible without login Plain text file database.php Aux. Configuration script
  Accessible without login Plain text file filesystems.php Aux. Configuration script
  Accessible without login Plain text file hashing.php Aux. Configuration script
  Plain text file jwt.php Class Class source
  Plain text file logging.php Class Class source
  Accessible without login Plain text file mail.php Aux. Configuration script
  Accessible without login Plain text file queue.php Aux. Configuration script
  Plain text file sanctum.php Class Class source
  Accessible without login Plain text file services.php Aux. Configuration script
  Accessible without login Plain text file session.php Aux. Configuration script
  Accessible without login Plain text file view.php Aux. Configuration script

  Files folder image Files (133)  /  database  
File Role Description
Files folder imagefactories (1 file)
Files folder imagemigrations (8 files)
Files folder imageseeders (6 files)

  Files folder image Files (133)  /  database  /  factories  
File Role Description
  Plain text file UserFactory.php Class Class source

  Files folder image Files (133)  /  database  /  migrations  
File Role Description
  Plain text file 2014_10_12_000000_create_users_table.php Class Class source
  Plain text file 2014_10_12_100000_...et_tokens_table.php Class Class source
  Plain text file 2019_08_19_000000_...iled_jobs_table.php Class Class source
  Plain text file 2019_12_14_000001_...ss_tokens_table.php Class Class source
  Plain text file 2024_12_12_070606_..._products_table.php Class Class source
  Plain text file 2024_12_12_115424_create_carts_table.php Class Class source
  Plain text file 2024_12_12_121238_...art_items_table.php Class Class source
  Plain text file 2024_12_12_162716_...te_orders_table.php Class Class source

  Files folder image Files (133)  /  database  /  seeders  
File Role Description
  Plain text file CartItemSeeder.php Class Class source
  Plain text file CartSeeder.php Class Class source
  Plain text file DatabaseSeeder.php Class Class source
  Plain text file OrderSeeder.php Class Class source
  Plain text file ProductSeeder.php Class Class source
  Plain text file UserSeeder.php Class Class source

  Files folder image Files (133)  /  docker  
File Role Description
Files folder imagenginx (1 file)
Files folder imagephp (1 file)

  Files folder image Files (133)  /  docker  /  nginx  
File Role Description
  Accessible without login Plain text file laravel.conf Data Auxiliary data

  Files folder image Files (133)  /  docker  /  php  
File Role Description
  Accessible without login Plain text file custom.ini Data Auxiliary data

  Files folder image Files (133)  /  public  
File Role Description
  Accessible without login Plain text file .htaccess Data Auxiliary data
  Plain text file index.php Class Class source
  Accessible without login Plain text file robots.txt Doc. Documentation

  Files folder image Files (133)  /  resources  
File Role Description
Files folder imagejs (2 files)
Files folder imageviews (1 file)

  Files folder image Files (133)  /  resources  /  js  
File Role Description
  Accessible without login Plain text file app.js Data Auxiliary data
  Accessible without login Plain text file bootstrap.js Data Auxiliary data

  Files folder image Files (133)  /  resources  /  views  
File Role Description
  Accessible without login Plain text file welcome.blade.php Aux. Configuration script

  Files folder image Files (133)  /  routes  
File Role Description
  Accessible without login Plain text file api.php Example Example script
  Accessible without login Plain text file channels.php Example Example script
  Accessible without login Plain text file console.php Example Example script
  Accessible without login Plain text file web.php Example Example scriptc

  Files folder image Files (133)  /  tests  
File Role Description
Files folder imageFeature (4 files)
Files folder imageUnit (1 file)
  Plain text file CreatesApplication.php Class Class source
  Plain text file TestCase.php Class Class source

  Files folder image Files (133)  /  tests  /  Feature  
File Role Description
  Plain text file CartTest.php Class Class source
  Plain text file OrderTest.php Class Class source
  Plain text file ProductTest.php Class Class source
  Plain text file UserTest.php Class Class source

  Files folder image Files (133)  /  tests  /  Unit  
File Role Description
  Plain text file ExampleTest.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads  
 100%
Total:0
This week:0