{"id":19552322,"url":"https://github.com/simonewebdesign/fushi","last_synced_at":"2025-04-26T20:31:41.142Z","repository":{"id":4237932,"uuid":"5362000","full_name":"simonewebdesign/Fushi","owner":"simonewebdesign","description":":seedling: Web development framework","archived":false,"fork":false,"pushed_at":"2013-08-12T13:30:27.000Z","size":1680,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T17:51:48.089Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://simonewebdesign.github.io/Fushi","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simonewebdesign.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-08-09T22:15:17.000Z","updated_at":"2020-06-26T16:53:08.000Z","dependencies_parsed_at":"2022-09-14T20:50:55.546Z","dependency_job_id":null,"html_url":"https://github.com/simonewebdesign/Fushi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonewebdesign%2FFushi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonewebdesign%2FFushi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonewebdesign%2FFushi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonewebdesign%2FFushi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonewebdesign","download_url":"https://codeload.github.com/simonewebdesign/Fushi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251051444,"owners_count":21528787,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T04:17:33.831Z","updated_at":"2025-04-26T20:31:40.525Z","avatar_url":"https://github.com/simonewebdesign.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Fushi PHP Boilerplate](https://raw.github.com/simonewebdesign/Fushi/master/public/img/fushi-logo.png)\r\n\r\nIntroduction\r\n------------\r\n\r\nFushi is a simple, lightweight PHP boilerplate (definition of [Boilerplate on Wikipedia](http://en.wikipedia.org/wiki/Boilerplate_code)).\r\n\r\nIt can be used for building a large variety of projects, small and large.\r\n\r\nIt has a very simple but powerful built-in templating system, as well as a pretty backend interface.\r\n\r\n\r\nFeatures\r\n--------\r\n\r\n- Modular, scalable and SEO friendly CSS frontend engine\r\n- Helper classes and functions for managing database tables\r\n- Helper class for pagination\r\n- A whole bunch of functions for a variety of tasks (see `library/functions/`)\r\n- SEO friendly URL rewrites\r\n- A powerful and secure session engine\r\n- Automagically add a new template that inherits CSS from the default one\r\n- User-friendly backoffice UI\r\n- gzip compression support\r\n\r\n\r\nRequirements\r\n------------\r\n\r\nIn order to run Fushi, you just need:\r\n- an Apache web server\r\n- PHP 5.2 or newer (it should potentially run in earlier versions, although I haven't tested yet.)\r\n- You must enable *rewrite_module* in Apache and *short open tag* in PHP settings.\r\n\r\n\r\nGetting started\r\n---------------\r\n\r\n1. Upload everything in the root of your web server.\r\n2. Open `/db` folder and create a new database with the provided MySQL dump.\r\n3. Go to `/config` folder and edit `database.php`. You'll also need to edit `paths.php` in the same folder.\r\n\r\nIf you have edited the above files properly, just surf to the root of your website and you should be able to see the home page.\r\n\r\n**Having trouble during installation? [Please let me know](https://github.com/simonewebdesign/Fushi/issues/new).**\r\n\r\n\r\nDocumentation\r\n-------------\r\n\r\n### File System\r\n\r\nIn alphabetical order and in a tree-structured way, I'll proceed describing the folders and their content.\r\n\r\n- **application** all files relative to the application itself.\r\n    - **backoffice** backend interface files.\r\n    - **includes** files that can be included inside templates.\r\n        - **forms**\r\n        - **galleries**\r\n        - **lists**\r\n        - **menus**\r\n    - **templates** all templates (backoffice included).\r\n- **config** configuration files (only constants here, *not* variables).\r\n- **db** database dump (*.sql)\r\n- **library** The core of Fushi.\r\n    - **classes**\r\n    - **functions**\r\n    - **session**\r\n- **public** the only folder publicly accessible.\r\n    - **css**\r\n        - **classes** css classes, usually reusable many times inside your app.\r\n        - **modules** css modules, (unique and independent parts of your app).\r\n        - **templates** css relative to single templates.\r\n    - **fonts** custom fonts (I personally use fontsquirrel.com)\r\n    - **img** all images.\r\n    - **icons** only sweetieplus by default.\r\n        - **sweetieplus**\r\n    - **js** all the JavaScript scripts.\r\n        - **libs** all the needed libraries (only jQuery by default).\r\n    - **media** multimedia files.\r\n        - **pdf**\r\n        - **video**\r\n    - **static** static HTML docs.\r\n        - **errordocs** HTTP error files (403 Forbidden, 404 Not Found, 500 Internal Server Error etc).\r\n    - **plugins**\r\n        - **tinymce** the TinyMCE editor, needed by backoffice.\r\n        - **galleria** jQuery galleria plugin.\r\n        - **fancybox** just another freaking jQuery plugin.\r\n- **scripts** any script that could reveal useful.\r\n- **tmp** unused.\r\n    - **cache** unused.\r\n    - **logs** unused.\r\n    - **sessions** unused.\r\n\r\n\r\n### Global Variables\r\n\r\nIn the most important file, `bootstrap.php`, are declared some fundamental variables:\r\n\r\n- **$get** is the `$_GET` array sanitized. It actually discards every variable in the URL that contains specials characters. It only accepts numbers, letters, hyphens and underscores.\r\n- **$template_name** is the name of the current template, getted from the URL. It equals `$get[0]`.\r\n- **$template** is an array taken from the database, containing the current template data:\r\n    - `$template['_id']`\r\n    - `$template['name']`\r\n    - `$template['title']`\r\n    - `$template['h1']`\r\n    - `$template['h2']`\r\n    - `$template['metaDescription']`\r\n    - `$template['metaKeywords']`\r\n- **$css** contains the links to the main stylesheets: `style.css` and `templates/$template_name.css` (the current template's CSS).\r\n- *Backoffice only:*\r\n    - **$table_name**\r\n    - **$action**\r\n    - **$id**\r\n\r\n\r\n### Frontend (CSS)\r\n\r\nThe frontend engine is based upon the [HTML5 Boilerplate](https://github.com/h5bp/html5-boilerplate) (v3.0.2, released on feb 19, 2012).\r\n\r\nYou're completely free to organize and manage your CSS as you wish: however I suggest you trying to maintain your structure as modular as possible. You can always use `@import url('style.css');` but this is discouraged. Use `application/boot.php` to arbitrarily import:\r\n\r\n- Classes from \t`public/css/classes/`;\r\n- Modules from \t`public/css/modules/`;\r\n- Templates from \t`public/css/templates/`.\r\n\r\nSo remember that when your web application has a modular piece (i.e. an header or footer), you can declare it as *module* and subsequently recall it in a specific template; you can even create new templates based on the concept of inheritance!\r\n\r\nThese \"non-semantic helper classes\" are available:\r\n\r\n- `.ir`\r\n- `.hidden`\r\n- `.visuallyhidden`\r\n- `.invisible`\r\n- `.clearfix`\r\n\r\nFor the explaining I recommend you reading the h5bp documentation: http://html5boilerplate.com/docs\r\n\r\nThe classes `.left` and `.right` just make block elements float to left or right respectively.\r\n\r\n\r\n### JavaScript\r\n\r\nJust two words on JavaScript: `script.js` is the main JS file, that loads automatically in every page.\r\nBesides that, you're free to load all *.js* files you want.\r\n\r\n[jQuery](http://jquery.com) is the Fushi's default library; if you need a different one, add it in `public/js/libs/` folder. If you need a jQuery plugin, add it in `public/plugins/` folder.\r\n\r\n\r\n### Ajax\r\n\r\nThe `public/js/ajax.js` file is responsible for managing **all Ajax requests**, and strictly collaborates with `public/ajax.php`.\r\n\r\nA detailed explaining of an Ajax request in Fushi:\r\n\r\n1. User clicks on a link.\r\n2. If that link has `class=action`, it will do an Ajax request.\r\n3. `ajax.php` will be loaded, and it will read the `href` attribute.\r\n4. The `href` will be parsed and Ajax will route to the right file.\r\n5. The right file will be executed.\r\n6. The `\u003cdiv id=response\u003e` will output the HTML.\r\n\r\nA concrete example:\r\n\r\n1. User clicks on `\u003ca class=\"action update\" href=\"fruit/update/3\"\u003eUpdate this!\u003c/a\u003e`.\r\n2. `ajax.js` loads `ajax.php`, passing the `href` to it (`fruit/update/3`).\r\n3. `ajax.php` realizes that `fruit_update.php` must be executed.\r\n4. `ajax.js` outputs the HTML returned by `fruit_update.php`.\r\n\r\n\r\n### The Backend (aka Backoffice)\r\n\r\nYou can access to the backend interface by `http://yoursite.com/backoffice`.\r\n\r\nExample user (administrator):\r\n- Username: **admin**\r\n- Password: **demo**\r\n\r\nExample user (no administrator privileges):\r\n- Username: **demo**\r\n- Password: **demo**\r\n\r\nHowever, you can't see anything in the backend if you have no admin privileges. Even though you try to login (or you're already logged in), in every circumstance you're just going to be redirected to the index.\r\n\r\nThe backend interface is based on the CRUD (create, read, update, delete).\r\nEvery table has usually 3 files in `application/backoffice/`.\r\n\r\nFor example:\r\n\r\nTable: **Products**\r\n\r\nFiles:\r\n- `products.php`\r\n- `products_form.php`\r\n- `products_read.php`\r\n\r\nThe 3 files above are handling all the operations behind the `Product` object.\r\n\r\nAs for *convention over configuration*, the table names must always be in plural form.\r\n\r\nFrom the backoffice you can also generate a template scaffold, but beware: you can't rename a template. If you need to delete a whole template, just remove its files: one is in `application/templates/`, and the other one is in `public/css/templates/`.\r\n\r\n### Sessions\r\n\r\nSessions are automatically handled by `lib/session.php`.\r\nYou will always have the following variables available globally:\r\n- `$session`\r\n    - `_id`\r\n    - `user_id`\r\n    - `sessionId`\r\n    - `ipAddress`\r\n    - `userAgent`\r\n    - `entryDate`\r\n    - `lastActivity`\r\n- `$user`\r\n    - `_id`\r\n    - `login`\r\n    - `name`\r\n    - `surname`\r\n    - `email`\r\n    - `password`\r\n    - `address`\r\n    - `cap`\r\n    - `city`\r\n    - `bio`\r\n    - `is_admin`\r\n    - `is_deleted`\r\n    - `created_at`\r\n    - `updated_at`\r\n    - `birthday`\r\n\r\n\r\nFAQ (Frequently Asked Questions)\r\n--------------------------------\r\n\r\n**Q:** I've uploaded every single file in the root of my web server, but Fushi throws weird errors like *unexpected T_FUNCTION*...\r\n\r\n**A:** Make sure you upload everything in binary mode.\r\n\r\n--\r\n\r\n**Q:** I get a 500: Internal Server Error. What can I do?\r\n\r\n**A:** This is usually related to `.htaccess` files. Please check your webserver's log.\r\n\r\n\r\n**Please [open a new issue](https://github.com/simonewebdesign/Fushi/issues/new) if you have any questions.**\r\n\r\n\r\n\r\nThank you for using Fushi! You are awesome!\r\n\r\n\r\n[![Open Source](https://raw.github.com/simonewebdesign/Fushi/master/public/img/opensource-75x65-t.png)](http://www.opensource.org/docs/definition.php)\r\n\r\nThis content is released under the [MIT License](https://github.com/simonewebdesign/Fushi/blob/master/LICENSE.md).\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonewebdesign%2Ffushi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonewebdesign%2Ffushi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonewebdesign%2Ffushi/lists"}