Comments (2)
I recommend https://github.com/gabordemooij/redbean
from core.
This is really beyond the scope of Flight... though you might notice mike maintains another repo which is a SQL tool: https://github.com/mikecao/sparrow
The best advice I can give you for using a database with flight is to use register
to set up a PDO instance for each connection you need. I do it like this:
Flight::register(
'db', # <= will be available as Flight::db()
'PDO',
# Arguments passed with the object is instantiated:
[
'sqlite:'. __DIR__ .'/whatever.db',
null,
null,
[
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
]
],
# Callback function run after its first instantiated
function ($db) {
$db->exec(
"CREATE TABLE IF NOT EXISTS blah (
id INTEGER PRIMARY KEY,
username TEXT,
password TEXT
)"
);
}
);
from core.
Related Issues (20)
- Compatibility issue with PHP 8.1-8.2 HOT 7
- Route preg_match() error HOT 1
- display_errors does not work with flight HOT 4
- route view rendered after redirect HOT 7
- Argument #1 ($ex) must be of type Exception, TypeError given HOT 2
- Cors in Framework HOT 5
- describing routes HOT 3
- Slashes In Routes HOT 2
- Website outdated version HOT 1
- I make a new framework βAlightβ, can anyone try it and give me some feedback? HOT 1
- Flushing buffer results in Response->write() error HOT 1
- Migrate to Flight 2 HOT 1
- Future of the Flight Micro Framework HOT 19
- Naming routes - help for navigation HOT 4
- Example projects - What would that look like ? HOT 14
- Possible integration with Roadrunner and Swoole. HOT 2
- Possible way to generate OpenAPI specification on the fly. HOT 1
- Possible deployment on AWS Lambda. HOT 1
- Possible way to include some shorthand helpers or utils. HOT 12
- Documentation on how to Docker-ize FlightPHP application. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.