panique / mini2 Goto Github PK
View Code? Open in Web Editor NEWJust an extremely simple naked PHP application, useful for small projects and quick prototypes.
License: MIT License
Just an extremely simple naked PHP application, useful for small projects and quick prototypes.
License: MIT License
Can somebody who's experienced with unit testing give infos about
I have created a Controller Products and I pass argument through index method like
http://127.0.0.1/product/index/123
How can I make it work like
http://127.0.0.1/product/123
I would really appreciate your help on this topic.
taken from php-mvc
NEVER MIND NEVER MIND NEVER MIND NEVER MIND. I THOUGHT COMPOSER WULDN'T WORK ON MAC. I WAS WRONG. ITS ACTUALLY THE EASIEST THING I'VE EVER INSTALLED FROM TERMINAL.
I have changed the composer.json, created a folder called vendor, and put sass-compiler.php in there. I am still getting Fatal error: Class 'SassCompiler' not found in /Applications/AMPPS/www/php-mvc-advanced-master/index.php on line 27. I got sass-compiler.php from https://github.com/panique/laravel-sass . Please help. I will temporarily comment out line 27 in index.php for now. Thanks, and great project. I can't wait to learn how to use and play around with TWIG and SASS compiler.
MINI2 currently consists of 2 simple .php files:
MINI2 is just a quick thing I've built for quick projects (in daily agency work you have setup sometimes 3 applications per week), and using real frameworks is totally overdoze in most cases, so this makes sense.
However, it might be better to
a.) move the configs
b.) split the model to multiple files, so the user can organize data-handling methods (like classic UserModel extends Model, you know what I mean :) ).
c.) move the routes, split the routes to multiple files
What do you think ? Ideas ? Code ? Feature branches ?
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] Connection refused' in /srv/http/php-mvc-advanced/application/libs/controller.php on line 35
I get this error, what might be the reason? Thanks.
I resolved problem with homepage, it is showing now after commenting out skip-networking in my.cnf file, however navigation does not redirect, when I click on link home/exampleone I get error 404 url not found, I have mod_rewrite installed and working.
Any intentions regarding upgrading Mini2 to Slim 3 compatibility when it's released? :-)
We are using this framework for a small development but we have modified the index.php to use an .env with https://github.com/vlucas/phpdotenv
Since we use git for our deployments we think it's safer not to store passwords from different environments in the same file, so .env it's actually ignored on git and there's one in every environment.
I have forked the repo and I can commit this change to pull request but I wanted to know if someone is actually interested in this change.
Currently the model is just one class in one file. Totally okay for the main purpose of this script. But this is for sure not cool when your model gets bigger. Possible idea:
UserModel::getUserById(17)
everywhere in your app.$model->getAllSongs();
would get another level, like $model->SongModel->getAllSongs();
Giving out application-wide feedback (positive, negative, etc.) after successful/failed actions could be a useful feature. I moved this ticket here from php-mvc basic version.
Hi!
Although it seems fairly obvious that MINI2 is completely open-source, I'm wondering if it'd be possible to explicitly give the project a license in the README
or via a license file (e.g. MIT, GPL, Apache, etc)? Doing so would be immensely useful when it comes to using MINI2 in projects that require all licenses to be explicitly stated.
Cheers!
while showing different possibilities of how to do searches, plus explaining the costs of these:
LIKE, MATCH AGAINST, external libs (Solr), etc.
sass-compiler
cannot access to style
file 0644 permission rule.
Because of www-data:www-data
(apache) and vagrant:vagrant
in different groups.
Maybe add chmod 0777 /var/www/html/myproject/public/css/style.css
in bootstrap.sh
?
Super-userful, and can be done with one line of code, totally decoupled, these days. Feel free to comment about potential useful scripts here that can be used for this.
So im a total nub when it comes to php and mvc so i might be totaly wrong here. Basicly i was trying to create a private function in my controler to do some basic checks and use it within other methods. While invoking this private method i came across error "Fatal error: Cannot redeclare class ....". After some googling i managed to fix this by changing "require" to "require_once" in loadModel method in libs/application.php (line 48). If this isnt an issie then sorry to bother You. if it is then You could check libs/controller.php for any possible similar errors.
First off big thank you for this/the basic version which has helped me no end. I was looking at extending the URL parameters by using an array and modifying the split URL and then just calling it in the construct if it exsists/not empty
My question is it safe to directly call the params $this->home->method($param_1, $param_2,3,4,5) from the one array or is there a reason the url_controller, url_action and params are kept seperate?
This is how I'm validating the url before parsing it to the 'filteredparam' array:
function spliturl ($string){
$untrusted = ltrim($string);
$ut2 = rtrim($untrusted,'/');
$ut3 = htmlspecialchars($ut2);
$ut4 = explode('/', $ut3);
$filteredparam;
$this->paramindex = 0;
foreach ($ut4 as $testcase) {
if (preg_match('/^[\w-]+$/',$testcase)) {
$this->filteredparam[$this->paramindex] = quickvalidate($testcase);
}
$paramindex++;
}
return $filteredparam;
}
function quickvalidate($string){
$clear = strip_tags($string);
$clear = html_entity_decode($clear);
$clear = urldecode($clear);
$clear = preg_replace('/[^A-Za-z0-9]/', ' ', $clear);
$clear = preg_replace('/ +/', '', $clear);
$clear = trim($clear);
return $clear;
}
maybe time for a soft update!
MINI uses Slim 2.4.3, but 2.5 has been released.
https://github.com/codeguy/Slim/releases
Routes that have parts in common can be grouped. Damn, I love Slim!
$app->group('/songs', function () use ($app, $container) {
$app->get('/', function () use ($app, $container) { ... }
$app->get('/xxx', function () use ($app, $container) { ... }
$app->get('/yyy', function () use ($app, $container) { ... }
}
Hi,
I would like to know how i can make global functions and how to use them.
So let me give an example.
I have an sort of Core file, where i can get stuff out of my database and these outputs can i use everywhere in the .twig files like an {{ constant('whatever') }}.
I don't know how i can do this.
It would be cool to have a perfect PSR-4 autoloader implementation here. Feel free to commit/push such thing into develop branch. The integration should be as correct as possible and also touch the composer autoloading (psr-4 is recommended here according to some good Stackoverflow answers) and possible unit testing.
Just a supersimple example! Would be cool if people with experiences in API-writing could give some guidance here, you know, doing it the right way.
My webhosting company doesn't allow me to set vhost.
I just can upload the files to "public_html"
I try to setup the following .htaccess at public_html folder.
It shows page not found.
But I can access the page via http://www.abc.com/public/.
My web hosting server works fine for Mini1 for the following .htaccess
RewriteEngine on
RewriteRule ^(.*) public/$1 [L]
It does not work for Mini2
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.