Git Product home page Git Product logo

mini2's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mini2's Issues

MINI2 license

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!

uncaught PDOException

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.

[check] Possible issue in loadModel()

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.

navigation does not work

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.

[moved to MINI3] Rebuild the model from one file to 1+ files

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:

  1. Use autoloading and static methods for model calls, so you could use something like UserModel::getUserById(17) everywhere in your app.
  2. Or, autoload different model-classes, so the current $model->getAllSongs(); would get another level, like $model->SongModel->getAllSongs();

[new feature] add feedback messages

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.

[TODO] What about using .env

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.

Where do i put sass-compiler.php ?

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.

[improvement] grouping routes

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) { ... }

}

[new feature] super-basic unit test integration

Can somebody who's experienced with unit testing give infos about

  1. how to test the database connection
  2. how to properly pass the database connection to tested models/model methods
  3. how to restructure the project to make everything testable as possible

[new feature] perfect PSR-4 integration (composer, unit tests, etc)

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.

[discussion] How could the architecture of this be improved ?

MINI2 currently consists of 2 simple .php files:

  1. /public/index.php, holding the initialization of Slim and Twig, the configs, the loading of the model and the routes for sure.
  2. MINI/model/model.php, which holds the data handling methods, so it's more or less the model.

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 ?

Global functions

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.

cannot setup vhost to /public

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

[new feature] basic search example

while showing different possibilities of how to do searches, plus explaining the costs of these:
LIKE, MATCH AGAINST, external libs (Solr), etc.

Q : More URL parameters

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;  
}

[new feature] basic JSON API example

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.