agentejo / lime Goto Github PK
View Code? Open in Web Editor NEWmicro php web framework
License: MIT License
micro php web framework
License: MIT License
i trying with post json body data but not work, i cannot get body data
example request data
{
"hello":"world"
}
last commit code:
Notice: Undefined index: base_url in /srv/http/lime/core/Lime/App.php on line 202
Notice: Undefined index: base_route in /srv/http/lime/core/Lime/App.php on line 203
In #7 PHP Warning issue not only on $app->on("after", function(){
, because ob_end_clean
Warning: file_exists(): open_basedir restriction in effect. File(views:test.php) is not within the allowed path(s): (/srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/proc/) in /srv/http/limewiki/app/core/Lime/App.php on line 419
AND var_dump($this->isAbsolutePath('views:test.php'));
return true;
I choice Lime for my next project with MongoLite (thanks for this 2 great projects), but i check the code and i think is useless use helpers and DiC in the same app, you want split the helpers for internal objects and DiC for external objects?
When lastest Commits:
Uncaught exception 'InvalidArgumentException' with message 'Identifier "name" is not defined
issue 'src/Lime/App.php' line 189:
if(!isset($this["session.name"])){
$this["session.name"] = $this["name"];
}
should be $this["app.name"];
And README.md line 132:
return $this->app->render("pages/contact.php");
I'm having trouble formulating a bind pattern that works for detecting language slugs, while still correctly collecting page slugs from the URL (so the actual page loads).
The 3 patterns I'm trying to use are as follows:
"#/(en|de)?\/?$#"
"#/(en|de)?#/:slug"
"#/(en|de)?\/?gallery#"
The actual function for the :slug
URL is as follows:
$app->bind("#/(en|de)?\/?#:slug", function($params) use($app) {
$post = collection('Pages')->findOne(["Slug_slug"=>$params['slug']]);
return $app->render('views/page.php', ['post' => $post]);
});
The first one works as expected: it matches /
, /en
, /en/
, /de
and /de/
. And the gallery pattern matches /gallery
, /en/gallery
and /de/gallery
. The problem is that all URLs that rely on :slug
return a "path not found" error.
I've tried the pattern with the closing delimiter after :slug
, but have not had any success. Is there an obvious issue I'm missing?
I think about using Lime for an application and I just compared the both files App.php
from Cockpit and from this repo. I realized many differences between both applications. As far as I understood, Lime is a dependency of Cockpit and should also work as a standalone micro framework. The version bundled with Cockpit has some improvements and a lot of cleanup.
@artur Do you plan to update this repo and to keep it in sync with the cockpit version?
Oh - and the license info at the top of App.php is the content of MIT License, but the headline "MIT License" is missing.
Wie organisiert man ein Projekt mit Modulen?
Gibt es einen Blog/ Dokumention zum Lime Framework?
In the events section, as far as I can tell,
$app->response["status"]
and $app->response["body"]
should be:
$app->response->status
and $app->response->body
I'm trying to bind a class as the root route. Something like: "http://mysite.com/" showing the "index" method of my class "Pages". And not "http://mysite.com/pages".
I've tried using the second param of bindClass method (alias) with an empty string, like:
$app->bindClass("Pages", "");
But it fails using the "alias" param when an empty string returns false for a soft test at line 778:
$clean = $alias ? $alias : trim(strtolower(str_replace("\\", "/", $class)), "\\");
So, I could fix this changing the bindClass method. The changed lines are 778 and 780:
778 - $clean = $alias !== false ? $alias : trim(strtolower(str_replace("\\", "/", $class)), "\\");
779 -
780 - $this->bind(empty($clean) ? '/*' : '/'.$clean.'/*', function() use($self, $class, $clean) {
Maybe you could update it too ;)
How do i change the http status for my post routes exactly? It's always 404 and api testers can't return the output.
I have a class routed automatically: $app->bindClass('Admin');
From functions in that class I can access helpers using the long version, but not the shorthand:
$this->app->helper('db')
$this->app('db')
The second call fails: Call to undefined method Admin::app()
use qrcode library, some code:
$params['data'] = 'This is a text to encode become QR Code';
$this->response->mime = 'png';
$this->qrcode->generate($params);
But generate return None and output binary, response status is 404 will echo Path not found
.
Please give me some advice.
$app->pathToUrl("site:upload/common/logo.svg");
always return false;
problem in $app->path() method
in this line:
if (!isset($this->paths[$parts[0]])) return false;
in this line $this->paths property is empty, but in other iterations, it normally contains paths.
I'm in the process of testing out Cockpit CMS, which encourages the use of Lime in all their examples. So far, the only issue I've had is while trying to create a JSON file in PHP (from data in the Cockpit API) that I want to use for a small react app. The page is assigned the content-type text/html
, instead of application/json
, even though the view contains a header('Content-Type: application/json; charset=UTF-8')
.
Is there a way to change the content-type when using the $app-render()
method, or is there a recommended solution to this?
From the documentation I cannot see a way of capturing url's for pagination. Currently I have 2 routes woth the exact same code. Anyone who has a solution to handle this?
/page/:name/entries/
/page/:name/entries/p/1/
I really like your framework, but I stumbled upon the rather redundant code of App::set()
. I'd suggest to use something like this instead:
public function set($key, $value) {
$keys = explode('/',$key);
if (count($keys)>5) return false;
$registry =& $this->registry;
foreach ($keys as $key) {
$registry =& $registry[$key];
}
$registry = $value;
return $this;
}
That way you also won't have to limit the number of keys (but I kept the limit in case you had good reasons for it ^^).
I have a class bound to all admin/*
routes
$app->bindClass("Admin", 'admin');
Note how adding a trailing slash results in the route not being matched to Admin::index.
when my code:
$app->bind("/test", function() use($app){
//do something
}
however:
http://localhost/test (200)
http://localhost/test/ (404)
and in oo style class use:
$this->app('myhelper')->test();
error message:
Call to undefined Pages::app()
At this moment, URLs with query parameteres have to be defined as routes: /homescreen=1
In my opinion, a definition like /
should work, but it doesn't.
How does this handle mime/types?
I'm working more or less directly from the the Events example in the readme. When I try to render 404.php I get two errors:
[01-Jul-2014 20:52:26 UTC] PHP Warning: include(views/404.php): failed to open stream: No such file or directory in /Users/scott/Sites/Semantic_Redesign/cockpit/vendor/Lime/App.php on line 529
and
[01-Jul-2014 20:52:26 UTC] PHP Warning: include(): Failed opening 'views/404.php' for inclusion (include_path='.:/Applications/MAMP/bin/php/php5.4.4/lib/php') in /Users/scott/Sites/Semantic_Redesign/cockpit/vendor/Lime/App.php on line 529
I'm able to render templates normally (i.e. when there's a defined route using bind()
) but not during the after
event.
FastCGI does not pass PATH_INFO so this does not work
'route' => isset($_SERVER["PATH_INFO"]) ? $_SERVER["PATH_INFO"] : "/",
i changed it to use QUERY_STRING.
more here.
http://stackoverflow.com/questions/14555996/no-input-file-specified
This version of Lime requires PHP >=5.5 because of using function password_hash
.
on App.php line 855:
$pattern = '#^'.str_replace('\*', '(.*?)', preg_quote($route, '#')).'#';
explame:
$pattern = '#^/action/(.*?)#';
$path = '/action/edit';
result:
$matches is empty
I use $app->style('/assets/css/style.css')
will echo:
<link href="/assets/css/style.css" type="text/css" rel="stylesheet">
but my webapp is subdirectory /srv/http/test/
, href should be /test/assets/css/style.css, I know use $app->style($app->baseUrl('/assets/css/style.css'))
.
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.