Download the PHP package vimac/myspot without Composer
On this page you can find all versions of the php package vimac/myspot. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package myspot
MySpot
中文版读我 / Readme in Chinese
| About Me |
A PHP persistence framework based on PDO with sql map support.
Think this as a PHP lightweight alternative implementation of MyBatis.
It should be helpful when you write business database access code in PHP project.
Why?
PHP is my first choice when I decide to build something fast.
But data access code bothers me every time, so I decided to open this project.
Inspired by a simple data access library which is a part of a framework named "IRON", a proprietary library be used by a company named Youzan I worked for once. It's a great company, salute to the engineers in there.
(Sure, no code in this project comes from that "IRON" framework.)
Features
- A visual utility to generate the code of Data Access Object class file and configuration file, check out iCopyPaste
- A simple syntax support for simple condition sub statement
- A simple syntax support for SELECT..IN query which is poor in PDO
- Lightweight, all configuration stored in PHP native array
Requirements
- PHP 7.3+
- PHP PDO extension with proper database driver, MySQL or Sqlite recommend
- PHP JSON extension
Demo Project
See MySpot action in a project:
Installation
Usage
GUI Utility
You can use iCopyPaste to generate variants of basic queries, configuration template, DAO code template.
Downloads: iCopyPaste Release Page
Initialize
Configuration
Configuration file should be similar to this:
Special Syntax
MySpot implements a syntax parser to compile its special syntax to real PDO prepared statement
SELECT...IN Statement
:variable:
The variable
will be consider as a array and compile to (:variableItem0, :variableItem1, :variableItem2, ...)
Conditional Sub Statement
:variable?{ substatement }
The substatment
part will only available when variable
equals TRUE
SELECT
Normal SELECT query
SELECT..IN query
UPDATE
INSERT
DELETE
Conditional Sub Statement
Fetch result
Tests
License
MIT License