Invo - Sample application for the Phalcon PHP Framework

Overview

INVO Application

Phalcon is a web framework delivered as a C extension providing high performance and lower resource consumption.

This is a sample application for the Phalcon PHP Framework. We expect to implement as many features as possible to showcase the framework and its potential.

Please write us if you have any feedback.

Thanks.

NOTE

The master branch will always contain the latest stable version. If you wish to check older versions or newer ones currently under development, please switch to the relevant branch.

Get Started

Requirements

Installation

  1. Copy project to local environment - git clone [email protected]:phalcon/invo.git
  2. Copy file cp .env.example .env
  3. Edit .env file with your DB connection information
  4. Run DB migrations vendor/bin/phalcon-migrations migration run --config=migrations.php

Contributing

See CONTRIBUTING.md

Sponsors

Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]

Backers

Support us with a monthly donation and help us continue our activities. [Become a backer]

License

Invo is open-sourced software licensed under the New BSD License. © Phalcon Framework Team and contributors

Comments
  • Phalcon invo - volt does not compile

    Phalcon invo - volt does not compile

    New to phalcon, installed phalcon on mac followed instruction, got invo. when loading localhost/invo got Error code: ERR_EMPTY_RESPONSE on chrome. No cache volt.php in invo/cache/volt have already chmod 777 -R invo so it's not access right. Debugged under phpstorm failure (Process finished with exit code 139) in services.php line 80 $compiler->addFunction('is_a', 'is_a');

    Anyone can help ?

    opened by saadjabrane 12
  • Should the DB instance be shared

    Should the DB instance be shared

    Shouldn't the DB instance in index.php dependency injector be a shared instance? I noticed in my own testing that it drastically reduces the number of connections per request.

    opened by aleemb 10
  • Dotenv is necessary?

    Dotenv is necessary?

    config/config.php is rewritten from

        'database' => [
            'adapter' => getenv('DB_ADAPTER'),
            'host' => getenv('DB_HOST'),
            'username' => getenv('DB_USERNAME'),
            'password' => getenv('DB_PASSWORD'),
            'dbname' => getenv('DB_DBNAME'),
            'charset' => getenv('DB_CHARSET'),
    ],
    

    to

        'database' => [
            'adapter'  => $_ENV['DB_ADAPTER'] ?? 'Mysql',
            'host'     => $_ENV['DB_HOST'] ?? 'locahost',
            'username' => $_ENV['DB_USERNAME'] ?? 'phalcon',
            'password' => $_ENV['DB_PASSWORD'] ?? 'secret',
            'dbname'   => $_ENV['DB_DBNAME'] ?? 'phalcon_invo',
            'charset'  => $_ENV['DB_CHARSET'] ?? 'utf8',
        ],
    

    but after the change, $_ENV is referenced and Dotenv is not used, so isn't Dotenv unnecessary?

    Also, in .env.example, DB_DBNAME=invo, but the database name is changed like 'dbname' => $_ENV['DB_DBNAME'] ?? 'phalcon_invo', Is it intentional?

    Bug - Low 
    opened by s-ohnishi 7
  • Changed findFirstById() to findFirst()

    Changed findFirstById() to findFirst()

    I installed this demo today using Phalcon 1.3.2 to find the Edit Product Type feature does not function. When clicking the Edit Product Type button I was receiving a "array to string conversion" notice on line 64 and the "Product type to edit was not found" error message.

    Upon viewing other controllers, it seems that other edit functions such as that on the ProductsController use Model::findFirst() as opposed to Model::findFirstById().

    Please correct me if I'm wrong, as this is my first try at Phalcon... but my little change corrected the error for me.


    Changed ProductTypes:findFirstById() to ProductTypes::findFirst() in ProducttypesController.

    opened by tyler-shaw 6
  • ProductsForm - Numericality Not Found

    ProductsForm - Numericality Not Found

    Fatal error: Class 'Phalcon\Validation\Validator\Numericality' not found in /.../invo/app/forms/ProductsForm.php on line 52

    Changed line 9 from:

    use Phalcon\Validation\Validator\Numericality;

    to:

    use Phalcon\Mvc\Model\Validator\Numericality;

    opened by mabon 5
  • ProductsController.php is not working, bad line in ProductsForm.php

    ProductsController.php is not working, bad line in ProductsForm.php

    You have a bad code in line 121, $form->isValid($data, $product) This line causes error 'Internal Error Something went wrong, if the error continue please contact us'

    Even if u disable form validation (from line 121 to line 126 this script is NOT working - does nothing (does not update products even it if say 'Product was updated successfully'.).

    Probably same with '!$form->isValid($data, $product)' in line 85 - does not create new product. same error.

    There is as well error in line 9 of ProductsForm.php. Instead 'use Phalcon\Validation\Validator\Numericality;' should be 'use Phalcon\Mvc\Model\Validator\Numericality;'

    Anyay the question is how the correct path should look like for all classes (if in this example app this is bad)?

    Tested on xampp with phalcon version 1.3.4

    opened by CarbonMDM 4
  • Fatal error: Phalcon\Acl\Adapter\Memory::isAllowed()

    Fatal error: Phalcon\Acl\Adapter\Memory::isAllowed()

    Fatal error: Phalcon\Acl\Adapter\Memory::isAllowed(): The argument is not iterable() in /storage/htdocs/sites/invo/app/plugins/Security.php on line 92

    opened by doit76 4
  • unit testing examples?

    unit testing examples?

    Is there a way a complete coverage unit tests could be written for the app? I struggle with how to build out testing for my own apps, and a good example would be well appreciated.

    Enhancement 
    opened by jellisii 3
  • Change the SecurityPlugin attached event to beforeExecuteRoute - services.php

    Change the SecurityPlugin attached event to beforeExecuteRoute - services.php

    NotFoundPlugin for handling the '404 not found' does not get chance to fire as beforeDispatch event fired before beforeException.

    Change the "SecurityPlugin" attached event to "beforeExecuteRoute" from "beforeDispatch" should solve the problem.

    opened by isaacliu 3
  • [INVO Bug] One Bug happens when edit an item

    [INVO Bug] One Bug happens when edit an item

    When I find out, I saw one bug in INVO project.

    This bug happens on all model. It displays wrong notice when edit an item

    Scenario:

    • Choose any model, search them. In this scenario, i chose Company
    • Click _Edit_ any item.
    • Clear data of any required row.
    • Click _Save_
    • The notice appear (Something like this: "Name is required")
    • Add info for that required row
    • Click _Save_
    • The notice appear not correctly

    Expect notice: Company was updated successfully

    Actual notice: Company was created successfully

    I think this bug happens because of code:

    CompaniesController.php

    
        $data = $this->request->getPost();
        if (!$form->isValid($data, $company)) {
                foreach ($form->getMessages() as $message) {
                    $this->flash->error($message);
                }
                return $this->forward('companies/new');
            }
    
    

    I'm just a newbie with Phalcon. So how can we fix that?

    Thanks so much.

    opened by hknguyenvu 3
  • in invo, i test the dispatch event

    in invo, i test the dispatch event

    in Security.php, i find here used befroeDispatch. but i don't found this event in http://docs.phalconphp.com/en/0.7.0/reference/dispatching.html

    so i test this; and add beforeDispathLoop, afterDispatch and afterDispatchLoop

    
        public function beforeDispatch(Phalcon\Events\Event $event, Phalcon\Mvc\Dispatcher $dispatcher)
        {
    
            $auth = $this->session->get('auth');
            if (!$auth){
                $role = 'Guests';
            } else {
                $role = 'Users';
            }
    
            $controller = $dispatcher->getControllerName();
            $action = $dispatcher->getActionName();
    
            $acl = $this->getAcl();
    
            $allowed = $acl->isAllowed($role, $controller, $action);
            if ($allowed != Phalcon\Acl::ALLOW) {
                $this->flash->error("You don't have access to this module");
                $dispatcher->forward(
                    array(
                        'controller' => 'index',
                        'action' => 'index'
                    )
                );
                return false;
            }
    
        } 
        public function beforeDispatchLoop(Phalcon\Events\Event $event, Phalcon\Mvc\Dispatcher $dispatcher) {
            $this->flash->error('beforeDispatchLoop');
        } 
    
        public function beforeExecuteRoute(Phalcon\Events\Event $event, Phalcon\Mvc\Dispatcher $dispatcher) {
            $this->flash->error('beforeExecuteRoute');
        }
    
        public function beforeExecute(Phalcon\Events\Event $event, Phalcon\Mvc\Dispatcher $dispatcher) {
            $this->flash->error('beforeExecute');
        }
    
        public function afterExecuteRoute(Phalcon\Events\Event $event, Phalcon\Mvc\Dispatcher $dispatcher) {
            $this->flash->error('afterExecuteRoute');
        }
    
        public function beforeNotFoundAction(Phalcon\Events\Event $event, Phalcon\Mvc\Dispatcher $dispatcher) {
            $this->flash->error('beforeNotFoundAction');
        }
    
        public function afterDispatch(Phalcon\Events\Event $event, Phalcon\Mvc\Dispatcher $dispatcher) {
            $this->flash->error('afterDispatch');
        }
    
        public function afterDispatchLoop(Phalcon\Events\Event $event, Phalcon\Mvc\Dispatcher $dispatcher) {
            $this->flash->error('afterDispatchLoop');
        }
    

    i visit a backend url, like http://invo.com/products/index

    order list result is :

    beforeDispatchLoop

    You don't have access to this module

    beforeExecuteRoute

    This is a sample application of the Phalcon PHP Framework. Please don't provide us any personal information. Thanks // this line is excute action result

    afterExecuteRoute

    afterDispatch

    afterDispatchLoop

    but i edit invo code beforeDispatch to beforeDispatchLoop , the page is blank。code is:

    
        public function beforeDispatchLoop(Phalcon\Events\Event $event, Phalcon\Mvc\Dispatcher $dispatcher)
        {
    
            $auth = $this->session->get('auth');
            if (!$auth){
                $role = 'Guests';
            } else {
                $role = 'Users';
            }
    
            $controller = $dispatcher->getControllerName();
            $action = $dispatcher->getActionName();
    
            $acl = $this->getAcl();
    
            $allowed = $acl->isAllowed($role, $controller, $action);
            if ($allowed != Phalcon\Acl::ALLOW) {
                $this->flash->error("You don't have access to this module");
                $dispatcher->forward(
                    array(
                        'controller' => 'index',
                        'action' => 'index'
                    )
                );
                return false;
            }
    
        } 
        public function beforeDispatch(Phalcon\Events\Event $event, Phalcon\Mvc\Dispatcher $dispatcher) {
            $this->flash->error('beforeDispatch');
        } 
    

    two question:

    1. beforeDispatch, afterDispatch is the Name Conventions of dispatch event ?
    2. why i edit beforeDispatch's order , page show blank page ?
    opened by netstu 3
  • icon is not displayed

    icon is not displayed

    Invo uses bootstrap4.4.1 and uses <i class="glyphicon glyphicon-edit"></i> in .volt. However, bootstrap4 and newer do not include icons by default, and other icons (eg icons.getbootstrap.com or Font Awesome) cannot be used in the same way as v3.

    opened by s-ohnishi 0
  • Exception: Serialization of 'Closure' is not allowed

    Exception: Serialization of 'Closure' is not allowed

    In the searchAction of the controller, it is stored in Session/Bag as follows. However, the array returned by getParams() contains di, and Closure exists in it, so it cannot be serialized, so it fails to save to the session.

    $this->persistent->searchParams = $query->getParams();
    

    This failure can be avoided by excluding the key di from the array returned by getParams(). for example

                 $params = $query->getParams();
                 unset($params['di']);
                 $this->persistent->searchParams = $params;
    

    or

    $this->persistent->searchParams = array('di'=>null) + $query->getParams();
    
    opened by s-ohnishi 0
  • Fatal error during migration

    Fatal error during migration

    I did the following for the migration.

    vendor/bin/phalcon-migrations run --config=migrations.php
    

    Then the following message is displayed.

    Fatal Error: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1' for key 'PRIMARY'
    

    I don't understand it well, so I put echo __CLASS__,'::',__FUNCTION__,':',__LINE__,PHP_EOL; in many places and executed it, and the result is as follows.

    Phalcon\Migrations\Console\Commands\Migration::run:102
    Phalcon\Migrations\Migrations::run:387
    Phalcon\Migrations\Mvc\Model\Migration::migrate:317
    CompaniesMigration_100::afterCreateTable:115
    Phalcon\Migrations\Mvc\Model\Migration::batchInsert:800
    /srv/vendor/phalcon/migrations/src/Mvc/Model/Migration.php:903:
    string(178) "INSERT INTO companies (id,name,telephone,address,city) VALUES ('1','Acme','31566564','Address','Hello'),('2','Acme Inc ','+44 564612345','Guildhall, PO Box 270, London','London');"
    Phalcon\Migrations\Mvc\Model\Migration::migrate:324
    CompaniesMigration_100::up:88
    Phalcon\Migrations\Mvc\Model\Migration::batchInsert:800
    /srv/vendor/phalcon/migrations/src/Mvc/Model/Migration.php:903:
    string(178) "INSERT INTO companies (id,name,telephone,address,city) VALUES ('1','Acme','31566564','Address','Hello'),('2','Acme Inc ','+44 564612345','Guildhall, PO Box 270, London','London');"
    

    It seems that afterCreateTable() and up() are called in succession in Migration::migrate. (each calling batchInsert() )

    Is this because these two are defined in companies.php? Or is it a bug in phalcon/migrations?

    opened by s-ohnishi 1
  • Trying to run an older project but docker-php-ext-enable phalcon is not recognised

    Trying to run an older project but docker-php-ext-enable phalcon is not recognised

    When I am trying to run my project with the provided dockerfile in this git and changing the Phalcon version to 3.1.1 and PHP version to 7.4 I get the following on the step:

    RUN docker-php-ext-enable \
        opcache \
        phalcon \
        xdebug
    

    phalcon does not exist. I cannot check it on a newer version because it is an old project.

    Not a bug 
    opened by spoilerdo 1
  • INVO does not have order management ?

    INVO does not have order management ?

    From @salesiss on November 6, 2017 2:20

    Expected and Actual Behavior

    INVO sample application does not have or is not showing any order management (create/edit/delete) for 'INVOICES'.

    Describe what you are trying to achieve and what goes wrong. Create, edit, delete and manage invoices.

    Provide output if related. Provide coredump if any.

    Provide minimal script to reproduce the issue simply install invo from a fresh php 7.1 / ngnix 1.12 and try to add an invoice. there was no functionalty avaliable.

    // paste code
    

    Details

    • Phalcon version: (php --ri phalcon) 3.2.4
    • PHP Version: (php -v) 7.1.7
    • Operating System: amazon ami ec2 / m3.large
    • Installation type: Compiling from source || installing via package manager compiling via source
    • Zephir version (if any):
    • Server: Nginx 1.12.1
    • Other related info (Database, table schema): mysql 5.6 new/fresh install.

    something very strange with invo - it s not showing neither edit nor manage invoices - is this normal qt

    Copied from original issue: phalcon/cphalcon#13147

    Enhancement 
    opened by sergeyklay 0
Releases(v2.0.0)
Owner
The Phalcon PHP Framework
High performance, full-stack PHP framework delivered as a C extension.
The Phalcon PHP Framework
Album-o-rama - Sample application for the Phalcon PHP Framework.

Album O'Rama Phalcon PHP is a web framework delivered as a C extension providing high performance and lower resource consumption. This is a sample app

The Phalcon PHP Framework 84 Oct 7, 2022
Magento sample data includes a sample store, complete with more than 250 products

Magento sample data includes a sample store, complete with more than 250 products (about 200 of them are configurable products), categories, promotional price rules, CMS pages, banners, and so on. Sample data uses the Luma theme on the storefront.

Magento 203 Dec 16, 2022
A Phalcon paginator adapter for Phalcon Collections

Phalcon Collection Paginator A Phalcon paginator adapter for Phalcon Collections Why create this? Being familiar with the various Pagination data adap

Angel S. Moreno 2 Oct 7, 2022
Sample application to bookmark links, where interface build with Angular.js + Twitter Bootstrap and server powered by PHP with Slim Framework

RESTful Bookmarks PHP Slim TODO: review and update FrontEnd Sample application to bookmark links, where interface build with Angular.js + Twitter Boot

Erko Bridee 50 Dec 15, 2021
Sample Web Application in Laravel with tailwind css

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Mulindwa Denis 1 Nov 26, 2021
Implementation of an API application using the Phalcon Framework

phalcon-api Sample API using Phalcon Implementation of an API application using the Phalcon Framework https://phalcon.io Installation Clone the projec

The Phalcon PHP Framework 81 Dec 15, 2022
Phalcon Demo Application

Phalcon Demo Application We use modified Phalcon INVO Application to demonstrate basics of Codeception testing. We expect to implement as many feature

Codeception Testing Framework 42 Oct 7, 2022
Sample code for several design patterns in PHP 8

DesignPatternsPHP Read the Docs of DesignPatternsPHP or Download as PDF/Epub This is a collection of known design patterns and some sample codes on ho

null 21k Jan 5, 2023
Easy Repository pattern for PHP Phalcon framework.

Phalcon Repositories Introduction Phalcon Repositories lets you easily build repositories for your Phalcon models, for both SQL and Mongo drivers. PHP

Michele Angioni 18 Oct 7, 2022
Incubator adapters/functionality for the Phalcon PHP Framework

Phalcon Incubator This is a repository to publish/share/experiment with new adapters, prototypes or functionality that can potentially be incorporated

The Phalcon PHP Framework 735 Dec 27, 2022
CMS based on Phalcon PHP Framework with modular structure

Yona CMS Yona CMS - open source content management system (CMS). Written in Phalcon PHP Framework (version 3.x supported) Has a convenient modular str

Alexander Torosh 369 Dec 27, 2022
A sample project to showcase a real world example and benchmarks for crowphp

CrowPHP Sample project This project is to showcase an example of how a real world project might look like. It has two basic endpoints to show-case the

Crow PHP 3 Aug 16, 2021
A highly compressed version of the magento 1.9 sample data and a script to create it.

Compressed Magento 1.9 Sample Data The following variations are available: 65M compressed-magento-sample-data-1.9.2.4.tgz 64M compressed-magento-sampl

Vinai Kopp 120 Sep 9, 2022
A powerful debug and profilers tool for the Phalcon Framework

Phalcon Debugbar Integrates PHP Debug Bar with Phalcon Framework. 中文说明 Features Normal request capturing Ajax request capturing Redirect request chain

Yajie Zhu 162 Oct 7, 2022
Phalcon PHP Meta tags Service

About Phalcon meta tags plugin for PhalconPHP. This plugin allows you to easily and flexibly customize the meta tags of your view. If this plugin help

null 12 Oct 7, 2022
PHP Profiler & Developer Toolbar (built for Phalcon)

Prophiler - A PHP Profiler & Developer Toolbar built for Phalcon Demo The demo website has been moved to a separate repository: https://github.com/fab

Fabian Fuelling 444 Dec 27, 2022
Phalcon official Forum

Phosphorum 3 Phosphorum is an engine for building flexible, clear and fast forums. You can adapt it to your own needs or improve it if you want. Pleas

The Phalcon PHP Framework 361 Dec 27, 2022
A composer package designed to help you create a JSON:API in Phalcon

phalcon-json-api-package A composer package designed to help you create a JSON:API in Phalcon What happens when a PHP developer wants to create an API

Jim 36 Oct 7, 2022
Setupify is a Phalcon provisioning and development tool.

Setupify Provisioning Tool WARNING: Setupify is currently in a state of experimentation. Use tag release. Setupify is a collection of bash scripts for

Perch Labs 3 Oct 7, 2022