Download the PHP package icebox-php/framework without Composer
On this page you can find all versions of the php package icebox-php/framework. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download icebox-php/framework
More information about icebox-php/framework
Files in icebox-php/framework
Package framework
Short Description The Icebox Framework.
License MIT
Homepage http://torovin.com/icebox
Informations about the package framework
About Icebox
This repository contains the core code of the Icebox framework.
ActiveRecord Implementation
Icebox includes a modern PDO-based ActiveRecord implementation with Rails-style query builder.
Database Configuration
Creating Models
Basic CRUD Operations
Rails-style Query Builder
Icebox uses a Rails-inspired query builder with a single where() method for all queries.
Basic Queries
Method Chaining
Aggregates and Checks
Model Methods Available
find($id)- Find by primary keywhere($column, $operator = null, $value = null)- Query builder entry pointsave()- Create or update recordupdateAttributes($attributes)- Update multiple attributesdelete()- Delete recordtoArray()- Convert to arrayisDirty()- Check if model has changesgetDirty()- Get changed attributes
Query Builder Methods
where($column, $operator = null, $value = null)- Add WHERE conditionorWhere($column, $operator = null, $value = null)- Add OR WHERE conditionwhereNull($column)- WHERE IS NULLwhereNotNull($column)- WHERE IS NOT NULLwhereIn($column, array $values)- WHERE INwhereNotIn($column, array $values)- WHERE NOT INwhereBetween($column, array $values)- WHERE BETWEENorderBy($column, $direction = 'ASC')- ORDER BYlimit($limit)- LIMIToffset($offset)- OFFSETget()- Execute and get resultsfirst()- Get first resultcount()- Get count of recordsexists()- Check if any records exist
Transactions
Interactive Console
Icebox includes an interactive PHP console (REPL) powered by PsySH, similar to Rails console:
This starts an interactive PHP shell. When used within an Icebox application, the framework and application environment will be automatically loaded.
Features
- Tab completion for class names, methods, and variables
- Syntax highlighting for better readability
- Documentation lookup with
doc function_name - Source code viewing with
show function_name - Command history with up/down arrows
- Error handling with pretty output
Example Usage
Available Commands in PsySH
exitorquit- Exit the consolehelp- Show helpdoc function_name- Show documentation for a functionshow function_name- Show source code for a functionls- List variables in current scopeclear- Clear the screen
Note for Application Usage
When using the console within an Icebox application, the application bootstrap will handle loading the framework and environment. The console command simply starts PsySH with the development environment.
Logging
Icebox includes a simple, Rails-like logger built on Monolog with PSR-3 compatibility. The logger supports multiple simultaneous handlers and works for both terminal and web applications.
Request Logging
When running the development server (php icebox server), Icebox automatically suppresses the default PHP built‑in server logs and provides Rails‑style request logging:
Each request receives a unique request id, timestamps should be in UTC (need more testing to check, Log use what timestamp).
Basic Usage
Handler Types
1. File Handler (with rotation)
2. Syslog Handler
3. Stdout Handler
4. Closure/ Broadcast Handler
Multiple Handlers Simultaneously
Log Levels
Each handler can have its own log level:
debug: Detailed debug informationinfo: Interesting eventsnotice: Normal but significant eventswarning: Exceptional occurrences that are not errorserror: Runtime errorscritical: Critical conditionsalert: Action must be taken immediatelyemergency: System is unusable
Testing
Notes
- No default handlers: Logs are silently ignored until handlers are added
- Multiple handlers: All added handlers receive log messages simultaneously
- Web/CLI compatibility: Works with Apache, Nginx, PHP built-in server, and CLI
- PSR-3 compliant: Interoperable with other PHP logging libraries
- Monolog under the hood: Uses the industry-standard Monolog library
How to run testsuite
You can run tests using the Icebox CLI:
This will run all tests in the tests folder.
To run a specific test file or folder:
Any additional arguments are passed directly to PHPUnit, so you can use PHPUnit options:
For more options, see php icebox test --help.
Crud generator
php icebox generate crud box
Test all column type
php icebox g crud post title:string picture:string content:text published:boolean publish_date:date create_time:datetime decimal_col:decimal float_col:float int_col:integer time_col:time