Giter Site home page Giter Site logo

micromvc's Introduction

MicroMVC PHP Framework

Why should I use this?

PHP is an interpreted scripting language and should not be expected to compile large collections of classes at runtime like other languages such as C. However, many PHP projects simply ignore this and attempt to build web applications with the same massive application design patterns as regular programs. The result is what we have today - websites that just can't handle any decent load.

On the other hand, MicroMVC is built with performance in mind. Easily one of the fastest frameworks ever made among the slue of small PHP frameworks. While most frameworks take 2-6MB of RAM to make a simple database request - MicroMVC can do it in less than .5MB while still using the full ORM.

MicroMVC is also fully PSR-0 compliant which means you can start using Symfony, Zend, Flurish, and other libraries right away!

All class methods are fully documented. Average class size is only 4kb which makes reading the codebase very easy and quick. IDE's such as eclipse or netbeans can pickup on the phpDoc comments to add instant auto-completion to your projects. In addition, full multi-byte string support is built into the system.

Composer

Warning: require(../vendor/autoload.php): failed to open stream: No such file or directory

MicroMVC requires Composer to work. Simply install composer and run composer inside the base MicroMVC directory. Composer will fetch the required PHP classes and install them inside the vendor directory (including the autoload.php).

$ composer install

Installation guide for Linux / Unix / OSX and Windows.

Requirements

  • Composer
  • PHP 5.3+
  • Nginx 0.7.x (legacy support for Apache with mod_rewrite)
  • PDO if using the Database
  • mb_string, gettext, iconv, ICU INTL & SPL classes

How do I install the PHP intl extension?

If you have errors about missing classes (like Locale) make sure you have the required PHP extensions installed.

  • Ubuntu/Debian: $ sudo apt-get install php5-intl php5-mcrypt php-gettext
  • Windows: uncomment extension=php_intl.dll, extension=php_mycrypt.dll, and extension=php_gettext.dll in your php.ini

License

MicroMVC is licensed under the Open Source MIT license, so you can use it for any personal or corporate projects totally free!

Built by David Pennington

micromvc's People

Contributors

adam187 avatar arwany avatar atourino avatar eryx avatar johnpbloch avatar paudam avatar xeoncross avatar

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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

micromvc's Issues

Installing micro/micro error!

Installing dependencies

  • Installing micro/micro (dev-master a0b700b)
    Cloning a0b700bebf6037cda663a76a5217475b34e518bd

    [RuntimeException]
    Failed to clone http://github.com/Xeoncross/Micro.git, git was not found, c
    heck that it is installed and in your PATH env.

    sh: git: command not found

I think the path was changed. Ist micro/micro the main source of micromvc which I've already downloaded from github or another source from another site?

About localization

I want to know how to use the 'Locale' folder.
For example, I need to localize the the Pagination links. What is the language file format, and how to arrange them in the 'Locale' folder. Any tips?

PS. I am new to this aspect, thanks in advance.

About missing /Class/Locale.php

Hi,
I saw there is solution for this problem, but I'm using share hosting, I can't modify the env.
And I'm trying to develop a application base on micromvc, it's users may use share hosting most.
Is there anothor solution?
Thanks!

Cannot load css file

After setup config, .htaccess and etc follow README folder and run in localhost
I got error 404 when load CSS/reset.css and CSS/style.css

How do I fixed this problem

little improvement in base url and some question

Hi, really like this project good for small projects but really need to improve the base i have played with the project you can only deploy the project only in root not in sub folders for example if i want to test my application in beta folder. need to ask few things
what is difference between site_url in config.php and DOMAIN defined in index.php can we put the whole thing in site_url config no need to define DOMAIN. well playing little bit with the framework i have added something in DOMAIN defined may be helpful

define('DOMAIN', (server('HTTPS')=='on'?'https://':'http://').h(server('SERVER_NAME')?server('HTTP_HOST'):server('SERVER_NAME')).str_replace(basename(server('SCRIPT_NAME')), '', server('SCRIPT_NAME')));

and site_url function can also be

function site_url($uri = NULL)
{
    return (strpos($uri,'://')===FALSE?DOMAIN:'').$uri;
}

with this you can access you framework in sub folders and you can remove forward slash from site_url. but again another problem you are slicing array in index.php at line 45 which is fixed in this case code check sub folder from url as module. we have to make this part little dynamic which can help make framework more flexible. another question why we are creating so many controller for one module these can be part of module controller class as function little more tweak can solve more problems.

too many installation problems

"Class 'Locale' not found in C:\xampp\htdocs\micromvc\Bootstrap.php"

It should not be so complicated to install.
You should be able to install from a tar ball.
Should not need composer.

It should be - just copy to folder and it should just work from localhost!
This is a bugged installation procedure.

I finally got it to work after renaming the Config.php and Route.php files And uncommenting extension=php_intl.dll in php.ini.
But it should give an info message instead of making a fatal error and having to dig through a google search to find the GitHub issues to fix it!
Why not have a default Config.php and Route.php already prepared for general use?
And what is with the Capital letters for folder and file names?

Minor stuff I guess but annoying. You really have to want to get it to work and make an effort to figure it out.

Error ID: Issue

After installation and configuring MicroMVC in a subfolder it is giving following message

Error ID:

Here is my config.json

{
"DB": {
"enabled" : "true",
"host" : "localhost",
"database" : "plu",
"username" : "root",
"password" : "123456"
},

"Core": {
    "routing"   : "true",
    "strictHost": "true",
    "hostname"  : "localhost",
    "rootFolder": "/var/www/html/micromvc/MicroMVC",
    "logErrors" : "true"
},

"Bower": {
    "sample_lib": {
        "override" : "false",
        "css"      : "template1/styles.css",
        "js"       : "template1/functions.js"
    }
}

}

public function route($path) { }

Theoretically, we can have a router
request this form site.com/ / slug1 / / / slug2 / slug3 / / / slug4 / / / slug5/slug6 / / / slug7 /

appropriate to hold two operations

public function route($path) {
$path = array_filter(explode('/',$path));
}

result

Array
(
[2] => slug1
[5] => slug2
[8] => slug3
[11] => slug4
[14] => slug5
[15] => slug6
[18] => slug7
)

with whom to work on

how to use function select() in orm

foreach(Example_Model_Dorm::select() as $dorm)
{
$this->content .= 'Show '. $dorm->name;
}

I not use fetch() bacause i want 1 row no all row in table.
What can i do.

multiple database connections?

Looking at micromvc/Class/Controller/School.php I see this commented section:

    // You can over-ride this in certain models if needed,
    // allowing you to use multiple databases.
    // Model_Name::$db = new DB(config('other_database'));

I tried something like (With no success):
zipcodeDB::$db = new DB(config('database2'));

Can anyone provide me a working example, I cant seem to get it to work. Thank you.

I'm not at my workstation now, so I will post my code/errors a bit later.

Coding standard

Is there a coding standard followed that I can continue to follow?

PHPUnit

could write test unitary, since facilitated much to developers.

Where is the Locale Class?

I got a error:

Warning: require(/Users/summer/Sites/localhost/micromvc/Class/Locale.php): failed to open stream: No such file or directory in /Users/summer/Sites/localhost/micromvc/Common.php on line 98 Fatal error: require(): Failed opening required '/Users/summer/Sites/localhost/micromvc/Class/Locale.php' (include_path='.:') in /Users/summer/Sites/localhost/micromvc/Common.php on line 98

uri_string security

hi,
you clean uri_segments by not uri_string.
So, if i want to get uri_string with fetch(), i am going to have bad characters in the uri_string.

At the end of the parse_uri() method , you could add this code :
$this -> uri_string = implode('/', $this -> uri_segments);

Missing function

"String::slug()" is not a valid function.

Class: upload.php inside of core.

Are you using MicroMVC?

If you are looking into MicroMVC or have used it for a project - leave a comment here. Also make sure to post any issues you have with the system.

Tag releases request

It would be great to have your MVC version tagged.

It could make easier to take control over updates using packagist.

Regards.

print vs echo function

I'm very excited to experiment this lightweight framework, but I was reading the code before and Why do you use the "print" function, if the "echo" function is a little bit more efficient?

http://www.phpbench.com/

Database - Use with PHP < 5.3 (low priority)

Installed, playing around - ended up figuring out issues 7 & 8 (autoload case and subdirectory install), but ran into a wall with the database.

Got a lot of errors, then later realized my php version was 5.1. However, was playing with your separate database class - https://github.com/Xeoncross/database - which works totally fine. From a cursory comparison, it seems more logically laid out, but that could just be due to the fact that it's not "compressed".

Therefore, not so much of an issue, but more a question -- is there a significant difference between the standalone db and the one included in micromvc? i.e. is one "better" than the other, or can I switch the newer one out? The example from the other project gives the impression that it's more flexible (documentation would be nice), but again it could just be the compression.

failed to open Class/Locale.php

I was download micromvc 4.0.0 and config apache/.htaccess, nename Config/*... but it does not work.

error massges:

PHP Warning: require(/opt/src/labs-git/php-framework-benchmark-v2/micromvc4/Class/Locale.php): failed to open stream: No such file or directory in /opt/src/labs-git/php-framework-benchmark-v2/micromvc4/Common.php on line 98
PHP Fatal error: require(): Failed opening required '/opt/src/labs-git/php-framework-benchmark-v2/micromvc4/Class/Locale.php' (include_path='.:/usr/share/php:/usr/share/pear') in /opt/src/labs-git/php-framework-benchmark-v2/micromvc4/Common.php on line 98

By the way, if there have a Quick Start, or MVC Demo?

Since Composer is in the place

[18-Jan-2013 15:10:49 UTC] PHP Warning: require(System/Error.php): failed to open stream: No such file or directory in D:\Projects\Assistance\vendor\micro\micro\Micro\View.php on line 60
[18-Jan-2013 15:10:49 UTC] PHP Fatal error: require(): Failed opening required 'System/Error.php' (include_path='.;c:\php\includes') in D:\Projects\Assistance\vendor\micro\micro\Micro\View.php on line 60
[18-Jan-2013 15:10:49 UTC] PHP Warning: require(System/Exception.php): failed to open stream: No such file or directory in D:\Projects\Assistance\vendor\micro\micro\Micro\View.php on line 60
[18-Jan-2013 15:10:49 UTC] PHP Fatal error: require(): Failed opening required 'System/Exception.php' (include_path='.;c:\php\includes') in D:\Projects\Assistance\vendor\micro\micro\Micro\View.php

Files are in /View and it's a fresh install

Where not equal

Hello all,

This is the first php framework I have ever worked with, and so far it seems great, so thank you!

A quick question on how I would/could create a where statement array where a key value is not equal?

Here is the code which at present counts the rows as expected:

$lc_userwhere = array("created_uuid" => $_SESSION['uid-x'], "deleted" => "0");

$lc_userleads = $this::count($lc_userwhere);

But say I wanted to only count rows where:

"created_uuid" != $_SESSION['uid-x'];

How can I do this?

Bootstrap __autoload() function improperly casing file path

When I load up MicroMVC on my local machine I get the following error:

Warning: require(/home/chris/dropbox/workspace/issues/system/error.php): failed to open stream: No such file or directory in /home/chris/Dropbox/workspace/Issues/bootstrap.php on line 110 Fatal error: require(): Failed opening required '/home/chris/dropbox/workspace/issues/system/error.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/chris/Dropbox/workspace/Issues/bootstrap.php on line 110

The require path it's looking for has the incorrect case for the Dropbox and Issues folder which both should be capitalized. The correct path should be: /home/chris/Dropbox/workspace/Issues/system/error.php

The fault appears to lie within the __autoload() function (around line 110 in v3.1.0).

missing Local.php

setup config/bootstrap && used .htaccess file you included.

wepage reveals this error, but there is no Local.php.

Warning: require(/var/www/frameworks/micromvc/Class/Locale.php): failed to open stream: No such file or directory in /var/www/frameworks/micromvc/Common.php on line 86 Fatal error: require(): Failed opening required '/var/www/frameworks/micromvc/Class/Locale.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/frameworks/micromvc/Common.php on line 86

Thank you,

about theming

Hi,
is there a way to config theme to use different suits of views?

Change of structure of calls to controllers

David,

It seems that there's a been a change over the history in this project and I'm just wondering why. To give you context, I'm new to PHP MVC frameworks and wanting to get started without bloat. I'm digging into MicroMVC a bit and trying to understand how things work.

To the issue at hand.

It seems that in previous versions (not exactly sure where this stopped) each controller was defined as a class with multiple methods that correlated with individual actions. So this URL:

/controller/action/params

would cause a call to: $controller->$action( $params)

However in later versions, it seems that each controller-action combination is defined as a class with an action method that would get called whenever the controller-action was called. The aforementioned URL would result in a call to $controller_$action->action($params)

So my questions:

  1. Am I correct in my understanding.
  2. Why the switch, what's the benefits?

Thanks for your time.

How to write hook

How to write hook in micromvc look like slim.before.router (slim framework)

Class Locale missing?

I'm probably missing something obvious here but I can't find the required Locale class?

Getting Page not Found

I just downloaded micromvc and when try to http://localhost:8080/ , I keep getting

  404 The requested resource / was not found on this server.  

How should I correct the .htaccess ? I have not made any changes to any files download.

How to: Form Validation

Here I have a basic form:

$validation = new \Micro\Validation($_POST);
$form = new \Micro\Form($validation);
print '<form method="post">';
print $form->email->label('email');
print $form->password->label('password')->attributes(array('type'=>'password'));
print '<input type="submit"/></form><br/>';

How to perform validation, i.e., set rules "email" and "required" for these fields?

Thanks for any hint you can provide.

Bootstrap in line 40

Hello, in Bootstrap in line 40 has the require for /vendor/autoload.php, only this directory and file not exists in project.. anybody can help me..?

Deprecated iconv_set_encoding in PHP 5.6

In this morning I tried to run on PHP 5.6 and got this error

Deprecated: iconv_set_encoding(): Use of iconv.internal_encoding is deprecated in /var/www/micromvc/Bootstrap.php

problems with .htaccess (i think).

I just downloaded the latest version of MicroMVC, got it up and running on my site and have some problems with the htaccess I think.

When I go to: "subdomain.com/MicroMVC/", I get a nice listing.

If I go to: "/MicroMVC/welcome/index", I get a page with "No input file specified." on it. All of the links along the top of the first page do this. Any ideas?

I g

PHP 5.3 -> PHP 5.5

I'm using MicroMVC on a server using PHP 5.3 and it works pretty good. But for some reason I needed a development server with Ubuntu 14.04 LTS using PHP 5.5.

I copy the same website on this new server but it doesn't work anymore. It looks like MicroMVC is unable to auto load class. And when I try to get variables config, array is empty ..

Is MicroMVC working on PHP 5.5 ? If not, must we do some change ?

Regards,

HTTP 500 Internal server errors..

Dude I can't even set this framework up, and I'm no newbie.

Did a fresh install of version 3.1 on my localhost:8888 machine
php5 & mod rewrite enabled on my server

renamed sample.htaccess to .htaccess
application folder renamed to "localhost"
config file renamed accordingly

Nothing.
HTTP 500 internal server error..

About Locale.php

Hi,

I see that many others have my same issue.

I have successfully installed the required libs with some hack which I found on web, for make it work on windows.

Also my live server have not it, and I never see it somewhere else...

Will be great to provide an alternative to remove it.

Since for me it's installed now, but when using cmd for run php CLI, then it said that is not found :(

bug in class routes ?

hi,
i have a problem with this line 81 in the file named "micromvc / libraries / routes.php" :

$segment = preg_replace('/[^'. preg_quote($this->permitted_uri_chars). ']+/i', '', $segment);

This regular expression delete all alphanumeric characters in the uri_string.

I think the problem is the single quote in the code because if i replace the single quote by double quote like this :

$segment = preg_replace("/[^'. preg_quote($this->permitted_uri_chars). ']+/i", '', $segment);

, it work fine.

Bug or not ?

Best regards

Bug in ORM.php

In vendor/micro/micro/Micro/ORM.php:341

It says

        if(empty(static::$has_many_through[$alias]))
        {
            throw new Exception ($alias . ' relation not found');
        }

But ORM is inside the Micro namespace, so it should be

        if(empty(static::$has_many_through[$alias]))
        {
            throw new \Exception($alias . ' relation not found');
        }

Deploying a site on subdirectory results in 404

I've setup .htaccess correctly and set the $config['site_url'] in the config.php file

I'm still shown a 404 and it looks like it doesn't know anything of my subdirectory. Checking site_url() returns my domain without the subdirectory.

Any suggestions?

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.