Giter VIP home page Giter VIP logo

nicedog's Introduction

Nice Dog

Nice Dog is a nano web framework for PHP, like web.py for Python, Sinatra or Camping for Ruby
Minimal

require 'NiceDog.php';
R('')->controller('test')->action('index')->on('GET');
class Test extends C{
    public function index(){
        echo 'Hello';
    }
}
run();

But Why?

If you want to build a small site or software and do not need a BIG framework with a lot of features, you can use Nice Dog. Nice Dog do not have any ORM or big features like Cake, Rails or Django have, but it is smaller, easier and faster!

Just 2 files

Get beta2.2 here .htaccess and NiceDog.php *Routes Fixed
Easy to deploy

Just drop the files into a folder in your Apache server!
Nice Urls

R('')->controller('test')->action('index')->on('GET');

Tutorial for who doesn't have time

   1. Get the files
   2. Put in your directory, like /var/www/htdocs/, no yaml, xml, *ml
   3. Create a index.php
   4. Just

      require('NiceDog.php')

   5. Make urls like this, define the url, class, method and HTTP method:

      R('tag/(?P<tag>[-\w]+)')->controller('Test')->action('p_tag')->on('GET');

   6. Write a class that extends C

      class Test extends C{}

   7. Write a method p_tag

      public function p_tag($tag){ echo $tag; }

   8. And

      run()

   9. Open in your browser: http://localhost/tag/dog

Templates

PHP works nice for templating, so lets use it!

public function p_tag($tag){
    $this->tag = $tag; 
    $this->render('views/index.php');
}

Base layout
views/layout.php

<h1>My firs example</h1>
<?=$content?>

*To change base layout do this: $this->layout="MyLayout.php"
Template
views/index.php

<span><?=$tag?></span>

License

The MIT License

Copyright (c) 2007 Tiago Bastos

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Contribute

Nice Dog created by Tiago Bastos under MIT license

nicedog's People

Contributors

bastos avatar

Stargazers

Bill Ortell avatar

Watchers

Bill Ortell avatar James Cloos avatar

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.