PHP Classes

How to Setup a PHP MVC Application Routes Extracted from Route Class Comments using Potato Service: Framework that extracts route details from classes

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 54 All time: 10,612 This week: 68Up
Version License PHP version Categories
potatoservice 1.0GNU General Publi...8.1Libraries, Design Patterns, PHP 8
Description 

Author

This package provides a framework that extracts route details from classes.

It implements the Command Query Responsibility Segregation pattern (CQRS) by parsing the routing information to route HTTP requests that match route pattern parameters defined in comments of the application route classes.

This framework uses PHP reflection to parse the application route classes comments and extract route details like the route:

- HTTP request type

- Name of the controller class and function name that will handle the routed request

- Required request headers

- Etc.

The framework can also validate the request parameters according to rules that applications define in map request classes.

Innovation Award
PHP Programming Innovation award nominee
September 2022
Number 5
PHP 8 implements the possibility to extract attributes defined in comments of PHP classes using PHP reflection support.

This package uses this possibility to implement an MVC framework that developers can use to configure HTTP request routes using route classes that comment attributes that define the details of the routing of HTTP requests to controller classes.

This way, developers can define the PHP application HTTP request routing configuration in the same class file that implements the routing code.

This possibility makes it easier to maintain complex PHP applications because it avoids the need to define routing PHP code in a separate file from the routing configuration.

Manuel Lemos
Picture of Maicon gonçalez
  Performance   Level  
Name: Maicon gonçalez <contact>
Classes: 5 packages by
Country: Brazil Brazil
Age: 30
All time rank: 2471171 in Brazil Brazil
Week rank: 200 Up15 in Brazil Brazil Up
Innovation award
Innovation award
Nominee: 3x

Documentation

PotatoService: API-Centric Framework

PotatoService is a comprehensive PHP framework meticulously crafted for API development. Infused with a plethora of features and streamlined methodologies, it stands out as a quintessential tool for creating scalable, reliable, and efficient APIs. Here's a dive into its core functionalities and design philosophies:

  1. Resource Management: At the heart of any RESTful API lies the principle of resource orientation. PotatoService offers a structured approach to map requests to specific resources, ensuring a clear and logical organization of endpoints.
  2. Dynamic Routing: Through the `#[Route]` annotation, the framework brings forth a flexible routing mechanism. This system is intricately designed to cater to various HTTP methods, establishing a foundation for a versatile API handling.
  3. Seamless Input Validation: APIs often act as gatekeepers, ensuring that only valid data interacts with the system. PotatoService's integrated validation attributes empower developers to define and rigorously check request inputs. This built-in robustness guarantees data integrity and security.
  4. Exception Handling with Clarity: In the realm of APIs, precise and informative feedback is paramount. PotatoService distinguishes between `BusinessException` and `ServerException`, delivering structured JSON responses. This nuanced approach ensures that clients receive clear and actionable error messages.
  5. Attribute-Driven Design: One of PotatoService's standout features is its rich attribute system. Attributes like `#[Cache]`, `#[Transactional]`, and various validations play pivotal roles in enhancing performance, ensuring data consistency, and maintaining data integrity.
  6. Interactive Console: A testament to its comprehensive nature, PotatoService boasts an interactive console. This tool is instrumental for backend operations, be it migrations, cache operations, or other housekeeping tasks, making API maintenance a breeze.
  • PHP Version Requirement: 8.1 or higher
  • Status: Alpha
  • Version: 0.1

Architectural Structure

The framework's architecture is divided into three distinct layers:

  1. Aplication Layer
  2. Domain Layer
  3. Infrastructure Layer

Configuration

  1. Project Settings: Modify the .env file to adjust your project settings. Path: infrastructure/.env -> $_ENV
  2. Dependencies: Set up and configure dependencies using composer. Path: infrastructure/composer.json

Wiki


  Files folder image Files (162)  
File Role Description
Files folder imageapplication (1 file, 3 directories)
Files folder imagedomain (1 file, 2 directories)
Files folder imageinfrastructure (4 files, 7 directories)
Accessible without login Plain text file .htaccess Data Auxiliary data
Accessible without login Plain text file index.php Aux. Auxiliary script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (162)  /  application  
File Role Description
Files folder imageconsole (6 files)
Files folder imageresources (1 file, 1 directory)
Files folder imagerunner (3 files)
  Accessible without login Plain text file .htaccess Data Auxiliary data

  Files folder image Files (162)  /  application  /  console  
File Role Description
  Plain text file CacheCommandConsole.php Class Class source
  Plain text file CacheCommandConsole.php Class Class source
  Plain text file ExecCommandConsole.php Class Class source
  Plain text file ExecCommandConsole.php Class Class source
  Plain text file HelpCommandConsole.php Class Class source
  Plain text file HelpCommandConsole.php Class Class source

  Files folder image Files (162)  /  application  /  resources  
File Role Description
Files folder imagerequest (1 file)
  Plain text file DemoQueryResource.php Class Class source

  Files folder image Files (162)  /  application  /  resources  /  request  
File Role Description
  Plain text file DemoResquest.php Class Class source

  Files folder image Files (162)  /  application  /  runner  
File Role Description
  Plain text file Console.php Class Class source
  Plain text file Console.php Class Class source
  Plain text file Main.php Class Class source

  Files folder image Files (162)  /  domain  
File Role Description
Files folder imagemodel (1 file)
Files folder imageservice (1 file)
  Accessible without login Plain text file .htaccess Data Auxiliary data

  Files folder image Files (162)  /  domain  /  model  
File Role Description
  Plain text file Teste.php Class Class source

  Files folder image Files (162)  /  domain  /  service  
File Role Description
  Plain text file TesteService.php Class Class source

  Files folder image Files (162)  /  infrastructure  
File Role Description
Files folder imagecache (3 files)
Files folder imagecore (1 file, 9 directories)
Files folder imageemail (2 files)
Files folder imagefile (1 file, 1 directory)
Files folder imagehelpers (2 files)
Files folder imagei18n (1 directory)
Files folder imagelibraries (1 directory)
  Accessible without login Plain text file .env Data Auxiliary data
  Accessible without login Plain text file .htaccess Data Auxiliary data
  Accessible without login Plain text file bootstrap.php Aux. Auxiliary script
  Accessible without login Plain text file composer.json Data Auxiliary data

  Files folder image Files (162)  /  infrastructure  /  cache  
File Role Description
  Accessible without login Plain text file .currentVersion Data Auxiliary data
  Accessible without login Plain text file .currentVersion Data Auxiliary data
  Plain text file CacheService.php Class Class source

  Files folder image Files (162)  /  infrastructure  /  core  
File Role Description
Files folder imageattributes (4 files, 1 directory)
Files folder imagedatabase (8 files, 2 directories)
Files folder imageenums (4 files)
Files folder imageexception (7 files)
Files folder imagefactory (1 file)
Files folder imagegeneral (7 files)
Files folder imagehttp (7 files)
Files folder imageinterfaces (6 files)
Files folder imagetraits (1 file)
  Plain text file PotatoCore.php Class Class source

  Files folder image Files (162)  /  infrastructure  /  core  /  attributes  
File Role Description
Files folder imagevalidation (23 files)
  Plain text file Autowired.php Class Class source
  Plain text file Cache.php Class Class source
  Plain text file Route.php Class Class source
  Plain text file Transactional.php Class Class source

  Files folder image Files (162)  /  infrastructure  /  core  /  attributes  /  validation  
File Role Description
  Plain text file AssertFalse.php Class Class source
  Plain text file AssertTrue.php Class Class source
  Plain text file Decimal.php Class Class source
  Plain text file Email.php Class Class source
  Plain text file Future.php Class Class source
  Plain text file FutureOrPresent.php Class Class source
  Plain text file Max.php Class Class source
  Plain text file MaxLength.php Class Class source
  Plain text file Min.php Class Class source
  Plain text file MinLength.php Class Class source
  Plain text file Negative.php Class Class source
  Plain text file NegativeOrZero.php Class Class source
  Plain text file NotBlank.php Class Class source
  Plain text file NotEmpty.php Class Class source
  Plain text file NotNull.php Class Class source
  Plain text file Numeric.php Class Class source
  Plain text file Password.php Class Class source
  Plain text file Past.php Class Class source
  Plain text file PastOrPresent.php Class Class source
  Plain text file Pattern.php Class Class source
  Plain text file Positive.php Class Class source
  Plain text file PositiveOrZero.php Class Class source
  Plain text file Url.php Class Class source

  Files folder image Files (162)  /  infrastructure  /  core  /  database  
File Role Description
Files folder imageattributes (3 files)
Files folder imageinterfaces (2 files)
  Plain text file EloquentDriver.php Class Class source
  Plain text file EntityModel.php Class Class source
  Plain text file FactoryDatabase.php Class Class source
  Plain text file Migration.php Class Class source
  Plain text file Migration.php Class Class source
  Plain text file PDOEasy.php Class Class source
  Plain text file PDOEasy.php Class Class source
  Plain text file Repository.php Class Class source

  Files folder image Files (162)  /  infrastructure  /  core  /  database  /  attributes  
File Role Description
  Plain text file Column.php Class Class source
  Plain text file Entity.php Class Class source
  Plain text file SetRepository.php Class Class source

  Files folder image Files (162)  /  infrastructure  /  core  /  database  /  interfaces  
File Role Description
  Plain text file iDriverImplements.php Class Class source
  Plain text file iRepository.php Class Class source

  Files folder image Files (162)  /  infrastructure  /  core  /  enums  
File Role Description
  Plain text file ContentType.php Class Class source
  Accessible without login Plain text file HttpRequest.php Aux. Auxiliary script
  Accessible without login Plain text file ResponseType.php Aux. Auxiliary script
  Accessible without login Plain text file StatusCode.php Aux. Auxiliary script

  Files folder image Files (162)  /  infrastructure  /  core  /  exception  
File Role Description
  Plain text file BusinessException.php Class Class source
  Plain text file EntityNotFoundOnModelException.php Class Class source
  Plain text file EnvironmentException.php Class Class source
  Plain text file InvalidRequestException.php Class Class source
  Plain text file RepositoryEntityNotFoundException.php Class Class source
  Plain text file ServerException.php Class Class source
  Plain text file SetRepositoryAttri...tFoundException.php Class Class source

  Files folder image Files (162)  /  infrastructure  /  core  /  factory  
File Role Description
  Plain text file FactoryResponse.php Class Class source

  Files folder image Files (162)  /  infrastructure  /  core  /  general  
File Role Description
  Plain text file GeneralReflection.php Class Class source
  Plain text file MapRequest.php Class Class source
  Plain text file OutputBuffer.php Class Class source
  Plain text file Password.php Class Class source
  Plain text file Services.php Class Class source
  Plain text file Session.php Class Class source
  Plain text file Smarty.php Class Class source

  Files folder image Files (162)  /  infrastructure  /  core  /  http  
File Role Description
  Plain text file Request.php Class Class source
  Plain text file Response.php Class Class source
  Plain text file ResponseHtml.php Class Class source
  Plain text file ResponseJson.php Class Class source
  Plain text file ResponseReturn.php Class Class source
  Plain text file RouteMap.php Class Class source
  Plain text file Routes.php Class Class source

  Files folder image Files (162)  /  infrastructure  /  core  /  interfaces  
File Role Description
  Plain text file iAttribute.php Class Class source
  Plain text file iCache.php Class Class source
  Plain text file iConsole.php Class Class source
  Plain text file iConsole.php Class Class source
  Plain text file iRunner.php Class Class source
  Plain text file iValidation.php Class Class source

  Files folder image Files (162)  /  infrastructure  /  core  /  traits  
File Role Description
  Plain text file Singleton.php Class Class source

  Files folder image Files (162)  /  infrastructure  /  email  
File Role Description
  Plain text file EmailHelper.php Class Class source
  Plain text file SendEmail.php Class Class source

  Files folder image Files (162)  /  infrastructure  /  file  
File Role Description
Files folder imageUpload (7 files, 2 directories)
  Plain text file Images.php Class Class source

  Files folder image Files (162)  /  infrastructure  /  file  /  Upload  
File Role Description
Files folder imageStorage (1 file)
Files folder imageValidation (4 files)
  Plain text file Autoloader.php Class Class source
  Plain text file Exception.php Class Class source
  Plain text file File.php Class Class source
  Plain text file FileInfo.php Class Class source
  Plain text file FileInfoInterface.php Class Class source
  Plain text file StorageInterface.php Class Class source
  Plain text file ValidationInterface.php Class Class source

  Files folder image Files (162)  /  infrastructure  /  file  /  Upload  /  Storage  
File Role Description
  Plain text file FileSystem.php Class Class source

  Files folder image Files (162)  /  infrastructure  /  file  /  Upload  /  Validation  
File Role Description
  Plain text file Dimensions.php Class Class source
  Plain text file Extension.php Class Class source
  Plain text file Mimetype.php Class Class source
  Plain text file Size.php Class Class source

  Files folder image Files (162)  /  infrastructure  /  helpers  
File Role Description
  Accessible without login Plain text file Core.php Example Example script
  Accessible without login Plain text file Handlers.php Example Example script

  Files folder image Files (162)  /  infrastructure  /  i18n  
File Role Description
Files folder imagept_BR (1 directory)

  Files folder image Files (162)  /  infrastructure  /  i18n  /  pt_BR  
File Role Description
Files folder imageLC_MESSAGES (1 file)

  Files folder image Files (162)  /  infrastructure  /  i18n  /  pt_BR  /  LC_MESSAGES  
File Role Description
  Accessible without login Plain text file messages.po Data Auxiliary data

  Files folder image Files (162)  /  infrastructure  /  libraries  
File Role Description
Files folder imageMoment (7 files, 2 directories)

  Files folder image Files (162)  /  infrastructure  /  libraries  /  Moment  
File Role Description
Files folder imageCustomFormats (1 file)
Files folder imageLocales (36 files)
  Plain text file FormatsInterface.php Class Class source
  Plain text file Moment.php Class Class source
  Plain text file MomentException.php Class Class source
  Plain text file MomentFromVo.php Class Class source
  Plain text file MomentHelper.php Class Class source
  Plain text file MomentLocale.php Class Class source
  Plain text file MomentPeriodVo.php Class Class source

  Files folder image Files (162)  /  infrastructure  /  libraries  /  Moment  /  CustomFormats  
File Role Description
  Plain text file MomentJs.php Class Class source

  Files folder image Files (162)  /  infrastructure  /  libraries  /  Moment  /  Locales  
File Role Description
  Accessible without login Plain text file ar_TN.php Aux. Auxiliary script
  Accessible without login Plain text file ca_ES.php Example Example script
  Accessible without login Plain text file cs_CZ.php Aux. Auxiliary script
  Accessible without login Plain text file da_DK.php Aux. Auxiliary script
  Accessible without login Plain text file de_DE.php Aux. Auxiliary script
  Accessible without login Plain text file en_CA.php Aux. Auxiliary script
  Accessible without login Plain text file en_GB.php Aux. Auxiliary script
  Accessible without login Plain text file en_US.php Aux. Auxiliary script
  Accessible without login Plain text file eo.php Aux. Auxiliary script
  Accessible without login Plain text file es_ES.php Example Example script
  Accessible without login Plain text file fa_IR.php Aux. Auxiliary script
  Accessible without login Plain text file fi_FI.php Aux. Auxiliary script
  Accessible without login Plain text file fr_CA.php Aux. Auxiliary script
  Accessible without login Plain text file fr_FR.php Aux. Auxiliary script
  Accessible without login Plain text file hu_HU.php Example Example script
  Accessible without login Plain text file id_ID.php Aux. Auxiliary script
  Accessible without login Plain text file it_IT.php Example Example script
  Accessible without login Plain text file ja_JP.php Aux. Auxiliary script
  Accessible without login Plain text file ko_KR.php Aux. Auxiliary script
  Accessible without login Plain text file kz_KZ.php Aux. Auxiliary script
  Accessible without login Plain text file lv_LV.php Aux. Auxiliary script
  Accessible without login Plain text file nl_NL.php Aux. Auxiliary script
  Accessible without login Plain text file no_NO.php Aux. Auxiliary script
  Accessible without login Plain text file oc_LNC.php Aux. Auxiliary script
  Accessible without login Plain text file pl_PL.php Example Example script
  Accessible without login Plain text file pt_BR.php Example Example script
  Accessible without login Plain text file pt_PT.php Aux. Auxiliary script
  Accessible without login Plain text file ro_RO.php Aux. Auxiliary script
  Accessible without login Plain text file ru_RU.php Aux. Auxiliary script
  Accessible without login Plain text file sv_SE.php Aux. Auxiliary script
  Accessible without login Plain text file th_TH.php Aux. Auxiliary script
  Accessible without login Plain text file tr_TR.php Aux. Auxiliary script
  Accessible without login Plain text file uk_UA.php Example Example script
  Accessible without login Plain text file vi_VN.php Aux. Auxiliary script
  Accessible without login Plain text file zh_CN.php Aux. Auxiliary script
  Accessible without login Plain text file zh_TW.php Aux. Auxiliary script

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 Download Rankings  
 100%
Total:54
This week:0
All time:10,612
This week:68Up