
กรอบ PHP MVC ที่มีน้ำหนักเบาที่มีน้ำหนักเบา:
FOOTUP MVC Framework
├── app
│ ├── Config
│ │ ├── Autoload.php
│ │ ├── Config.php
│ │ ├── Constants.php
│ │ ├── Email.php
│ │ ├── Form.php
│ │ ├── Fuel.php
│ │ ├── Paginator.php
│ │ └── Routes.php
│ ├── Controller
│ │ ├── BaseController.php
│ │ └── Home.php
│ ├── Functions.php
│ ├── Lang
│ ├── Libs
│ ├── Middle
│ │ └── Maintenance.php
│ ├── Migration
│ ├── Model
│ │ └── Contact.php
│ ├── Seed
│ └── View
│ └── home.php
├── composer.json
├── core
│ ├── Boot.php
│ ├── Cli
│ │ ├── Commands
│ │ │ ├── Assets.php
│ │ │ ├── Controller.php
│ │ │ ├── Middle.php
│ │ │ ├── Migfree.php
│ │ │ ├── Migrate.php
│ │ │ ├── MigrateTrait.php
│ │ │ ├── Migrown.php
│ │ │ ├── Migrup.php
│ │ │ ├── Model.php
│ │ │ ├── Multiple.php
│ │ │ ├── Scaffold.php
│ │ │ ├── Seeder.php
│ │ │ ├── Seed.php
│ │ │ ├── Serve.php
│ │ │ └── View.php
│ │ ├── Exception
│ │ │ ├── Exception.php
│ │ │ ├── InvalidArgumentException.php
│ │ │ ├── InvalidParameterException.php
│ │ │ └── RuntimeException.php
│ │ ├── Helper
│ │ │ ├── InflectsString.php
│ │ │ ├── Normalizer.php
│ │ │ ├── OutputHelper.php
│ │ │ └── Shell.php
│ │ ├── Input
│ │ │ ├── Argument.php
│ │ │ ├── Command.php
│ │ │ ├── Groupable.php
│ │ │ ├── Option.php
│ │ │ ├── Parameter.php
│ │ │ ├── Parser.php
│ │ │ └── Reader.php
│ │ ├── IO
│ │ │ └── Interactor.php
│ │ ├── Konsole.php
│ │ ├── logo
│ │ ├── logo_txt
│ │ ├── Output
│ │ │ ├── Color.php
│ │ │ ├── Cursor.php
│ │ │ ├── Table.php
│ │ │ └── Writer.php
│ │ └── Tpl
│ │ ├── Controller.tpl
│ │ ├── Middle.tpl
│ │ ├── Migrate.tpl
│ │ ├── Model.tpl
│ │ ├── Seed.tpl
│ │ └── View.tpl
│ ├── Config
│ │ ├── Autoload.php
│ │ ├── Config.php
│ │ ├── DotEnv
│ │ │ ├── DotEnv.php
│ │ │ └── Exception
│ │ │ ├── Exception.php
│ │ │ └── InvalidPathException.php
│ │ ├── Email.php
│ │ └── Mime.php
│ ├── Controller.php
│ ├── Database
│ │ ├── DbConnection.php
│ │ ├── Migration
│ │ │ └── Migration.php
│ │ ├── Migration.php
│ │ ├── QueryBuilder.php
│ │ ├── Schema
│ │ │ ├── Column.php
│ │ │ ├── ForeignKey.php
│ │ │ ├── IndexColumn.php
│ │ │ ├── Index.php
│ │ │ ├── Schema.php
│ │ │ └── Table.php
│ │ ├── Seeder
│ │ │ └── Seeder.php
│ │ └── Seeder.php
│ ├── Debug
│ │ ├── Contracts
│ │ │ └── HandlersInterface.php
│ │ ├── Exceptions
│ │ │ ├── CompileErrorException.php
│ │ │ ├── CompileWarningException.php
│ │ │ ├── CoreErrorException.php
│ │ │ ├── CoreWarningException.php
│ │ │ ├── DepricatedException.php
│ │ │ ├── NoticeException.php
│ │ │ ├── ParseErrorException.php
│ │ │ ├── RecoverableErrorException.php
│ │ │ ├── StrictErrorException.php
│ │ │ ├── UserDeprecatedException.php
│ │ │ ├── UserErrorException.php
│ │ │ ├── UserNoticeException.php
│ │ │ ├── UserWarningException.php
│ │ │ └── WarningException.php
│ │ ├── Handlers.php
│ │ ├── HandlersSetter.php
│ │ ├── Reporter.php
│ │ ├── resources
│ │ │ ├── assets
│ │ │ │ ├── css
│ │ │ │ │ ├── custom.min.css
│ │ │ │ │ ├── enlighterjs.min.css
│ │ │ │ │ └── spectre.min.css
│ │ │ │ └── js
│ │ │ │ ├── custom.min.js
│ │ │ │ └── enlighterjs.min.js
│ │ │ └── views
│ │ │ └── 500.php
│ │ ├── Support
│ │ │ └── functions.php
│ │ └── View.php
│ ├── Files
│ │ ├── File.php
│ │ └── FileSystem.php
│ ├── footup-ascii-art.png
│ ├── Footup.php
│ ├── Functions.php
│ ├── Html
│ │ ├── Form.php
│ │ └── Html.php
│ ├── Http
│ │ ├── Request.php
│ │ ├── Response.php
│ │ └── Session.php
│ ├── I18n
│ │ ├── Exceptions
│ │ │ └── I18nException.php
│ │ ├── TimeDifference.php
│ │ └── Time.php
│ ├── Lang
│ │ ├── fr
│ │ │ ├── core.json
│ │ │ ├── date.json
│ │ │ ├── db.json
│ │ │ ├── email.json
│ │ │ ├── file.json
│ │ │ ├── http.json
│ │ │ ├── paginator.json
│ │ │ ├── validator.json
│ │ │ └── view.json
│ │ └── Lang.php
│ ├── Model.php
│ ├── Orm
│ │ ├── BaseModel.php
│ │ └── ModelQueryBuilder.php
│ ├── Paginator
│ │ ├── AbstractPaginator.php
│ │ ├── Page.php
│ │ ├── PaginatorException.php
│ │ ├── PaginatorInterface.php
│ │ ├── Paginator.php
│ │ └── View
│ │ └── default.php
│ ├── Routing
│ │ ├── Middle.php
│ │ ├── Route.php
│ │ └── Router.php
│ └── Utils
│ ├── Arrays
│ │ ├── Arrayable.php
│ │ ├── ArrDots.php
│ │ ├── Arr.php
│ │ ├── Collection.php
│ │ └── Dots.php
│ ├── ClassLocator.php
│ ├── Shared.php
│ ├── Str.php
│ └── Validator
│ ├── Validate.php
│ └── Validator.php
├── env
├── footup
├── LICENSE
├── public
│ ├── assets
│ │ ├── avatar.jpg
│ │ ├── css
│ │ │ └── style.css
│ │ └── js
│ │ └── script.js
│ ├── error
│ │ ├── 404.html
│ │ └── 500.html
│ ├── favicon.svg
│ ├── index.php
│ └── uploads
├── README.md
└── server.php
Footup MVC Framework มุ่งเน้นไปที่ความเร็วและความเรียบง่ายเป็นหลัก มันคือ ซิป 250 kb , 148 kb xz มันแสดงผลด้วย 0.001 วินาที (ฉันใช้สภาพแวดล้อม PHP 8.0.7 เพื่อเขียนและทดสอบ)
เป้าหมายของฉันคือการทำสิ่งที่ฉันเป็นคนแรกที่ใช้อย่างง่ายดาย ฉันเพิ่มคุณสมบัติบางอย่างที่ช่วยให้ฉันทำงานได้เร็วขึ้นในการทำงานตลอดทั้งวัน
ยอ คุณสามารถดาวน์โหลดได้โดยตรงและใช้งานโดยไม่จำเป็นต้องพึ่งพาภายนอก รองรับไลบรารีนักแต่งเพลง แต่ฉันยังไม่ได้ตีพิมพ์ Footup แต่ยังเป็นนักบรรจุหีบห่อ
คุณต้องการ:
ตอนนี้ฉันเพิ่มคำสั่ง Generators
เพื่อแสดงความช่วยเหลือ:
nuka@hacker_pc: ~ $ php footup เพื่อสร้างคอนโทรลเลอร์:
nuka@hacker_pc: ~ $ php footup controller controllerNameอย่าอายลองเอง
คำขอและคลาสเราเตอร์เป็น มอเตอร์ BMW ที่พวกเขามีหลายสิ่งที่เป็นประโยชน์ ที่นี่เราใช้คำขอ:
// using get function to get the page=3 present in the url
$ this -> request -> get ( " page " );
// you can use like this to get the page
$ this -> request -> page ;
// What ? you typing enough ? and that ?
request ()-> page ;
// And What ? how to get file with name: image ?
// You can use as below
$ this -> request -> image ; // or $this->request->file('image')
// And What if image[] as multiple files ?
// You can use as below
$ this -> request -> files ( ' image ' );
# Yes you can access the request using the global function request() // using get function to validate the page=3 present in the url
$ this -> request -> withGetInput ()-> validate ([ " page " => " is:int " ]);
// What ? you typing enough ? and that ?
request ()-> withGetInput ()-> validate ([ " page " => " is:int " ]);
# Yes you can access the request using the global function request() // using get function to validate the page=3 present in the url
$ this -> response -> json ([ " page " => 2 ]); // second parameter to echo directly
# Yes you can access the response using the global function response()นี่คือคลาสที่ใช้ร่วมกันดังนั้นข้อมูลที่มีอยู่ยังคงเหมือนเดิมนี่คือตัวอย่าง:
// using set function to set session value
$ this -> session -> set ([ " page " => 2 ]); // or $this->session->page = 2
// What ? you typing enough ? and that ?
session ( " page " , 2 ); // session()->set("page", 2); or session()->page = 2;
// What ? i want to get the page ?
// So
session ( " page " ); // session()->get("page"); or session()->page;
# Yes you can access the session using the global function session() as shownหากคุณตรวจสอบข้อมูลด้วยตัวตรวจสอบความถูกต้องฟังก์ชันการตรวจสอบจะส่งกลับ จริง ถ้าทั้งหมดผ่านและ เท็จ เป็นอย่างอื่น
// Via request
// with post data
$ this -> request -> withPostInput ()-> validate ([ " page " => " is:int " ]);
// With post and get data
request ()-> withInput ()-> validate ([ " page " => " is:int " ]);
// With other data
request ()-> with ([ " page " => 2 ])-> validate ([ " page " => " is:int " ]);
// So how to get Error ?
// Simple
validator ()-> getError ( " page " ); // request()->getValidator()->getErrors(); to grab all
# Yes you can access the validator using the global function validator()
# You can validate using the global function validate() too <?php
namespace App Model ;
use Footup Model ;
class Contact extends Model{
// If not defined, the name of this class is used
protected $ table = ' contact ' ;
/**
* PrimaryKey
*
* @var string
*/
protected $ primaryKey = ' idcont ' ;
protected $ beforeInsert = [];
protected $ beforeFind = [];
protected $ beforeDelete = [];
protected $ beforeUpdate = [];
protected $ afterInsert = [];
protected $ afterFind = [];
protected $ afterDelete = [];
protected $ afterUpdate = [];
}
// Using the model Contact
. . . . .
use App Model Contact ;
. . . .
// Retrouve tout | retrieve all
$ contacts = Contact:: all ();
------------ others methods --------------
$ c = new Contact();
$ contacts = $ c -> get ();
foreach ( $ contacts as $ contact )
echo $ contact -> email ;
# you can also use
$ contact -> setEmail ( " [email protected] " );
// Generating form ******
$ contact -> getForm ();
var_dump ( $ c -> firstByEmail ( ' [email protected] ' ));
. . . . . . . . . . . . . . . . . . . . . . . . . .
คำขอ ($ index = null, $ arg = null)
/**
* Une fonction pour exposer l'objet Request
*
* @param mixed $index
* @param mixed $arg
* @return FootupHttpRequest|mixed
*/
request ( $ index = null , $ arg = null )เรียกว่า controller ($ withNamespace = true)
/**
* Retrouve le controlleur en cours d'utilisation
*
* @param boolean $withNamespace
* @return string
*/
calledController ( $ withNamespace = true )เรียกว่า method ()
/**
* Retrouve la méthode couremment utilisée
*
* method of the current called controller
*
* @return string
*/
calledMethod ()และหลาย ๆ คนอื่น ๆ ที่ทำหน้าที่ได้
#eg. file field = image
# @uses one below
request ( ' image ' ) or request ()-> image or request ()-> file ( ' image ' )
# remember that request is available directly in the controller so :
$ this -> request ->image
# et pour enregistrer le fichier | and for saving :
request ( ' image ' )-> save (?string $ destinationName = null , bool $ replace = true ) or request ()-> image -> save (?string $ destinationName = null , bool $ replace = true ) or request ()-> file ( ' image ' )-> save (?string $ destinationName = null , bool $ replace = true )
# remember that request is available directly in the controller so :
$ this -> request -> image $ contact = new ContactModel ();
$ contact -> getForm ( " # " , [], true /* true to print */ )
# or use
echo $ contact -> getForm ();ใช้ $ RESET = FALSE SI VOUS NE SOUHAITER PAS PAS THERINGENCER UNE requête ใช้ประโยชน์ $ Table Pour Changer de Table (Cette Méthode Vous L'Utiliserez Rarement)
- $ type doit être un dans ['inner', 'ult outer', 'ด้านนอกขวา', 'Full Outer']
- สตริงฟิลด์ $ array ex: "user.id = article.id_user" | ["user.id" => "article.id_user"]
- สตริงฟิลด์ $ array ex: "user.id = article.id_user" | ["user.id" => "article.id_user"]
- สตริงฟิลด์ $ array ex: "user.id = article.id_user" | ["user.id" => "article.id_user"]
- $ Key String | Array Ex: "id = 1" | ["id" => 1]
- สตริงลิงค์ $ ลิงค์คือและ | หรือ | เป็น
- $ ฟิลด์สตริง | อาร์เรย์ Ex: "Arnauld" | [2, 3, 5] สำหรับ $ Operator ใน | ไม่ได้อยู่ใน
/**
* @param string|array $key
* @param null $operator
* @param null $val
* @return $this
*/
public function whereOr( $ key , $ val = null , $ operator = null , $ escape = true ) /**
* @param $key
* @param array $val
* @return $this
*/
public function whereIn( $ key , array $ val , $ escape = true ) /**
* @param string $str
* @return $this
*/
public function whereRaw( $ str ) /**
* @param $key
* @param array $val
* @return $this
*/
public function whereNotIn( $ key , array $ val , $ escape = true ) /**
* @param string $key
* @return $this
*/
public function whereNotNull( $ key ) /**
* @param string $key
* @return $this
*/
public function whereNull( $ key ) /**
* Adds an ascending sort for a field.
*
* @param string $field Field name
* @return object Self reference
*/
public function asc( $ field ) /**
* Adds an descending sort for a field.
*
* @param string $field Field name
* @return object Self reference
*/
public function desc( $ field ) /**
* Adds fields to order by.
*
* @param string $field Field name
* @param string $direction Sort direction
* @return object Self reference
*/
public function orderBy( $ field , $ direction = ' ASC ' ) /**
* Builds an insert query.
*
* @param array $data Array of key and values to insert
* @return bool
*/
public function insert( array $ data = [])cette méthode doit êtreutiliséeaprès une clause ที่ไหน
/**
* Builds an update query.
*
* @param array $data Array of keys and values, or string literal
* @return bool
*/
public function update( $ data ) /**
* Builds a delete query.
*
* @param string|int|array $where Where conditions
* @return bool
*/
public function delete( $ where = null )si $ raw_sql est null, la méthode retourne une chaine de Caractères, retourne $ sinon นี้
/**
* Gets or sets the SQL statement.
*
* @param string|array SQL statement
* @return self|string SQL statement
*/
public function sql( $ sql = null ) /**
* Saves an object to the database.
*
* @param object $objet Class instance
* @param array $db_fields Select database fields to save (insert or update)
* @return boolean
*/
public function save( $ objet = null , array $ db_fields = null ) /**
* Removes an object from the database.
*
* @param object
* @return boolean
*/
public function remove( $ objet = null )หมายเหตุ: Si tu เป็นdéjàutilisé un framework comme codeigniter 4 tu maitriseras vite autres méthodes groupby, มี, จำกัด , ชดเชย, แตกต่าง, ระหว่าง, เลือก, สุดท้าย, min, count, max, avg, หนึ่ง {ฟิลด์} EST UN Table de la Table
/**
* Gets the database connection instance PDO.
*
* @return object Database connection
*/
public function getDb() /**
* Executes a sql statement.
*
* @return object Query results object
* @throws Exception When database is not defined
*/
public function execute( array $ params = []) /**
* Perform a query
*
* @param string $select
* @param array|string $where
* @param int $limit
* @param int $offset
* @return array - of object class
*/
public function get( $ select = " * " , $ where = null , $ limit = null , $ offset = null ) # Autres Méthodes
==================
/**
* Get the table name for this ER class.
*
* @access public
* @return string
*/
getTable ()
/**
* Get the primaryKey
*
* @access public
* @return string
*/
getPrimaryKey()
/**
* Get model property fields by data table.
*
* @access public
* @return array of available columns
*/
getFields ()
/**
* Create new data row.
*
* @access public
* @param array $properties
* @return object Model instance
* @return bool
*/
create (Array $ properties )
/**
* Find one model in the database.
* or create if not exists.
*
* @access public
* @param array $properties
* @return object Model instance
* @return array|bool if error occured
*/
findOrCreate (Array $ properties = null )
/**
* Find all model in the database.
*
* @access public
* @param mixed $where
* @return array|object
*/
public static function all( $ where = null ) <?php
namespace App Controller ;
use App Model Contact ;
class Home extends BaseController{
public function index (){
// Retrouve la méthod utilisée | HTTP Verb
if ( $ this -> request -> method () === ' post ' ){
// retrouve un fichier | retrouve uploaded file
$ image = $ this -> request -> file ( ' image ' );
// save
$ image -> save ();
// get the name of the moved file
echo $ image -> name ;
}
// Using model Contact
// all() est la seule méthode statique | all() is the only static method
$ contacts = Contact:: all ();
$ contacts = ( new Contact ())-> get ());
// Afficher la vue | display the vue
return $ this -> view ( " accueil " , [
" titre " => " Accueil "
]);
}
}
Paginator Iranianpep/Paginator
รูปแบบการตรวจสอบ PDSCOPES/PHP-FORM-VALIDATOR
PHP Arrays PDSCOPES/PHP-Arrays
PHP CLI โดย ADHOCORE ADHOCORE/PHP-CLI
ลิขสิทธิ์ (c) 2021, faustfizz [email protected] สงวนลิขสิทธิ์
อนุญาตให้แจกจ่ายและใช้งานในรูปแบบแหล่งที่มาและไบนารีโดยมีหรือไม่มีการแก้ไขได้รับอนุญาตหากเป็นไปตามเงื่อนไขต่อไปนี้:
การแจกจ่ายซ้ำของซอร์สโค้ดจะต้องรักษาประกาศลิขสิทธิ์ข้างต้นรายการเงื่อนไขและข้อจำกัดความรับผิดชอบต่อไปนี้
การแจกจ่ายซ้ำในรูปแบบไบนารีจะต้องทำซ้ำประกาศลิขสิทธิ์ข้างต้นรายการเงื่อนไขและข้อจำกัดความรับผิดชอบต่อไปนี้ในเอกสารและ/หรือวัสดุอื่น ๆ ที่ได้รับการแจกจ่าย
ไม่ว่าจะเป็นชื่อของผู้ถือลิขสิทธิ์หรือชื่อของผู้มีส่วนร่วมในการรับรองหรือส่งเสริมผลิตภัณฑ์ที่ได้จากซอฟต์แวร์นี้โดยไม่ได้รับอนุญาตเป็นลายลักษณ์อักษรล่วงหน้า
ซอฟต์แวร์นี้จัดทำโดยผู้ถือลิขสิทธิ์และผู้มีส่วนร่วม "ตามที่เป็นอยู่" และการรับประกันโดยชัดแจ้งหรือโดยนัยใด ๆ รวมถึง แต่ไม่ จำกัด เพียงการรับประกันโดยนัยของความสามารถในการค้าและความเหมาะสมสำหรับวัตถุประสงค์เฉพาะ ไม่ว่าในกรณีใดผู้ถือลิขสิทธิ์หรือผู้มีส่วนร่วมจะต้องรับผิดชอบต่อความเสียหายทางตรงทางอ้อม, โดยบังเอิญ, พิเศษ, เป็นแบบอย่าง, หรือความเสียหายที่ตามมา (รวมถึง แต่ไม่ จำกัด เพียงการจัดหาสินค้าทดแทนหรือบริการการสูญเสียข้อมูลหรือผลกำไรหรือการหยุดชะงักของธุรกิจ แนะนำถึงความเป็นไปได้ของความเสียหายดังกล่าว