ice / framework Goto Github PK
View Code? Open in Web Editor NEWSource code of Ice framework
Home Page: https://www.iceframework.org
License: BSD 3-Clause "New" or "Revised" License
Source code of Ice framework
Home Page: https://www.iceframework.org
License: BSD 3-Clause "New" or "Revised" License
it seem that dispatcher::forward()
is not a well work feature. show a user case would be very helpful.
Use mongodb
instead of mongo
on php7 (add a new db driver).
help!
Starting php-fpm: [24-Feb-2017 09:42:45] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/ice.so' - /usr/lib64/php/modules/ice.so: undefined symbol: php_json_decode_ex in Unknown on line 0
PHP Version 7.0.16
centos6.3
GET route is overriding the POST route and conversely, eg. uri /post/123
and routes:
['GET', '/{controller:[a-z]+}/{id:\d+}'],
['POST', '/{controller:post}/{id:\d+}'],
A request was made of a resource using a request method not supported by that resource
Related issue nikic/FastRoute/issues/25
it'll be very convenient to access DI instance when ModuleInterface::registerAutoloaders()
is changed to ModuleInterface::registerAutoloaders(variable $di)
.
public function registerAutoloaders()
{
(new Loader())
->addNamespace(__NAMESPACE__ . '\Controllers', __DIR__ . '/controllers/')
->register();
}
VS
// better performance
public function registerAutoloaders(Di $di)
{
$di->loader->addNamespace(__NAMESPACE__ . '\Controllers', __DIR__ . '/controllers/');
}
Due to array fetching zephir-lang/zephir#1140 (comment)
http://admin.example.com
will auto route to and load admin module
I would like to learn more deeply about this framework.
If i set rules like this and I want to edit model
$validation = new Validation();
$validation->rules([
'shortName' => 'required|unique:categories,shortName,' . $this->getId() . '|length:2,16',
]);
It is not working because in mongo there is _id
instead of id
.
I'm getting error exception after sign in with remember me option:
ErrorException[8]: unserialize(): Error at offset 0 of 34 bytes
It occurs on one app, but not with another. Looks like error with fcache (works before this commit) or zephir latest changes.
Strange trace:
#0 [internal function]: unserialize('Ice\\Auth\\Driver\\Model\\Users\\Tokens')
#1 [internal function]: Ice\Mvc\Model->unserialize('Ice\\Auth\\Driver\\Model\\Users\\Tokens')
#0 [internal function]: unserialize('echo')
#1 [internal function]: Ice\Mvc\Model->unserialize('echo')
#0 [internal function]: unserialize('1\x00\x00\x00\x00\x00\x00\x001\x00\x00\x00\x00\x00\x00')
#1 [internal function]: Ice\Mvc\Model->unserialize(Array)
#2 [internal function]: Ice\Auth\Driver\Model->getUser()
It may be related with the crypt.zep#L100, because auth/driver/model.zep#L185 launches cookies.zep#L102 during remember me option. Auth and Crypt uses unserialize function but with diferent data.
If I change serialize/unserialize to json_encode/json_decode in the mvc/model.zep#L622 or disable cookies encrypt it works. I'm trying to add code to reproduce this issue.
The current version of https://github.com/kenjis/php-framework-benchmark shows that Phalcon has a higher throughput.
Are they made at different points in time? Can it be explained by the different hardware/OS/stack set-up?
static uri
is meaningless.
Url::rel()
- relative uri
Url::href()
-
I want to use a native SQL with binding params.
I create a new class that extend Ice\Db\Driver\Pdo, but I got follow error :
Call to private method Ice\Db\Driver\Pdo::where() from context 'App\Libraries\DBDriver'
I 'd better change where method to protected.any idea?
There is a bug in the 1.2.10 version with preg_match
introduced in zephir zephir-lang/zephir#1443
After checking if the request failed to pass validation,
I want to use the filtered values as the form's values.
Example:
$filteredValues = $this->validation->getValues();
$this->request->setPost($filteredValues);
how add extension on wampserver ?
I found there is Q&A for this feature. it'd be fine to add a helper method to run native sql
Could you confirm the following example?
$genders = [1 => 'male', 2 => 'female'];
$this->view->setVars(compact('genders'));
{% set field = 'gender' %}
{% foreach genders as key : value %}
<label>
{{ radio_field([field, key, 'id' : field ~ key, 'checked' : (this.request.getPost(field) == key ? 'checked' : '')])
{{ value }}
</label>
}}
{% endforeach %}
I want to use an IN
clause as the following example.
Users::find(['status' => ['NOT IN' => [0, 1]], 'deleted_at' => ['IS' => null]]);
Users::find(['status' => ['IN' => [2, 3]], 'deleted_at' => ['IS' => null]]);
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/ice.so' - /usr/lib64/php/modules/ice.so: undefined symbol: zval_used_for_init in Unknown on line 0
include_path => .:/usr/share/pear:/usr/share/php => .:/usr/share/pear:/usr/share/php
php version 7.1.21
Centos 7.5
Is there any chance to share compiled DLLs of this extension for windows users?
If static_uri
is without scheme eg. //example.com
, it will be always marked as local, so
{{ link_to([this.url.getStatic('contact'), 'Contact', 'local': false]) }}
{# will be ///example.com/contact #}
Hello,
Don't see a forum or whatever to post this question.
I'm just curious about what is the story with this framework? Is it a fork of phalcon, completely new but using zephir, etc?
I know there are threads regarding the slow progress, lack of PR merges and that kind of thing and people wanting cphalcon to move to an organization. Is that the reason or intent behind ice?
Thanks!
multi-line comment etc.
Sorry for this simple question. how can i setup to output when there are fatal errors happen. I got a blank page at this moment.
the id
property should be allowed to change in Model
If I want to render some partial html, I have to return a response object in the controller action. that limitation is a little tricky
class IndexController extends \Ice\Mvc\Controller {
public function indexAction()
{
$this->view->setContent('bla bla zzz'); // not work, no main layout file
}
public function index2Action()
{
$this->response->setContent('bla bla zzz');
return $this->response; // work!
}
}
$loader->addNamespace('', __DIR__ . '/Vendor/Parsedown')
or $loader->addNamespace('/', __DIR__ . '/Vendor/Parsedown')
or $loader->addNamespace("\\", __DIR__ . '/Vendor/Parsedown')
doesn't work for Parsedown
class dropped in __DIR__ . '/Vendor/Parsedown'
directory.
$mk = new Parsedown; // class not found
please fix line 78,these is no \
in the class name
I am so very confused by the name of ice/auth/driver/model.zep
. it has nothing to do with model
. rename it to db.zep
would be more clear.
db.zep -- database driver
file.zep -- file base driver
would u plz update the php_ice.dll
to the latest version?
thanks for so great framework
all these model hook names should have prefix or postfix to distinct different model type instances.
model.before.validate
model.after.validate
model.before.create
model.after.create
model.before.update
model.after.update
e.g.
class Model1 extends \Ice\Mvc\Model {
public function initialize()
{
$v = 'Model1';
$this->di->hook('model.before.validate', function () use ($v) {
echo 'model.before.validate:'.$v.'<br>';
});
}
public function apply()
{
$this->di->applyHook("model.before.validate", [$this]);
}
}
class Model2 extends \Ice\Mvc\Model {
public function initialize()
{
$v = 'Model2';
$this->di->hook('model.before.validate', function () use ($v) {
echo 'model.before.validate:'.$v.'<br>';
});
}
public function apply()
{
$this->di->applyHook("model.before.validate", [$this]);
}
}
$m1 = new Model1;
$m2 = new Model2;
$m3 = new Model1;
$m1->apply();
// echo
model.before.validate:Model1
model.before.validate:Model1 <---- double run
model.before.validate:Model2 <---- shouldn't be executed
If i do sth like this in the mongodb Model:
$this->position = $this->request->getPost('position', 'int');
$this->create()
I have numeric string representation instead of int
As a countermeasure for XSS, I want to use "autoescape" of "Twig".
If I instantiate some objects in the constructor(or onConstruct method), I create a hard dependency.
I want to resolve it. I need to pass some objects as arguments of the constructor(or onConstruct method).
I would like to use a LIKE clause as the following example.
$name = $this->request->getPost('name');
$escapedName = $this->example->escapeLike($name);
$users = Users::find(['name' => ['LIKE' => '%' . $escapedName . '%']]);
class Example {
/**
* Escape for MySQL's LIKE clause
* @param string $string
* @return string
*/
public function escapeLike($string)
{
return str_replace(['%', '_'], ['\%', '\_'], $string);
}
}
How to setup a common route to match /module/controller/action/id/param.json
Handler Class with application/Controllers/ doesn't work.
ice-php/
.. application/
.. .. Controllers/
.. .. ..
Any idea?
I think this framework so simple than Phalcon but need more documentation like Bootstrap, Routing, Controller, Models, and other basics. And I have'nt found forum.
Sorry for My English, thanks!
fixed
public function getId()
{
if (is_array($this->primary)) {
$id = [];
foreach ($this->primary as $k) {
$id[] = $this->get($k);
}
} else {
$id = $this->get($this->primary);
}
return $id;
}
$this->response->setContent('bla bla zzz')
in the controller will not work
class IndexController extends \Ice\Mvc\Controller {
public function indexAction()
{
$this->response->setContent('bla bla zzz');
}
}
I tried to use ice,and set oracle as project's database, it not work,Is this framework not support Oracle?
`
$di->set('db', function () {
$tns = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SID=orcl)))';
$driver = new \Ice\Db\Driver\Pdo("oracle:dbname=" . $tns, 'user', 'password');
// not work too
// $driver = new \Ice\Db\Driver\Pdo("oci:dbname=orcl;host=localhost", 'user', 'password');
return new \Ice\Db($driver);
});
`
merge
is more like php array term
And we won't need erase
on Arr.
Hello.
I'm finding some PHP7 frameworks and see some benchmark pages.
This framework looks like so fast. amazing. but I don't know other features...
So what key points of this framework? now I'm planning use to lumen because I'll make not too big product.
Multiple nested optional parts are not working:
$this->di->set('router', function () use ($config) {
$router = new Router();
$router->setRoutes([
['GET', '/{controller:[a-z]+}/{action:[a-z]+}[/{id:\d+}[/{param}]]'],
]);
return $router;
});
should cover:
/post/list
/post/edit/1
/post/show/1/title
\ice\Filter#add
work properly on PHP7.0.7, but it does not work on PHP7.0.9.
Ice version is 1.2.0. Do you have any knowledge about this phenomenon?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.