SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Creating a Web service with the admin-panel using Yii and Backvendor

  1. #1
    SitePoint Member
    Join Date
    Sep 2012
    Location
    Charkow, Kharkivs'Ka Oblast', Ukraine, Ukraine
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Creating a Web service with the admin-panel using Yii and Backvendor

    Hi guys! Several days ago I've faced the quite interesting and perspective PHP-extention for the routine work automation called Backvendor. If you try it too please give the feedback. For all other I've made the small review and tested the extension.

    What is the Backvendor?

    As I said above the main Backvendor objective is the maximum project automation. It helps much in the initial stages. With the pair commands I've made the application architecture containing the web service and admin-panel, quickly set the CRUD for each model and made the relations between them. To my mind it looks much better and faster compare to the Yii standard tools.

    The detailed information of how it works possible to get on the Yii site and on the project homepage.

    For myself, I identified the next main features that truly may be useful (was taken form the official Backvendor page):

    - Just one console command to create basic structure of your multi application system with common core.
    - Backend engine that allows creating CRUD pages by setting configurations in Yii style.
    - Auto documentation of API version generated as a web page
    - API versioning.
    - Deployment script for moving your project to production server using Phing


    How it works

    Belove are the 3 Steps I've made using the Backvendor to make the simple project. Also you may review the demo one I've found in the GitHub.
    Step 1.

    Download the extension from the site and pt it in the folder with web access (I did not change name from backvendor). After that, type in the command line:

    Code:
    cd/path/to/webroot/backvendor
    php bviic.php createmultiapp - path = "/path/to/webroot/my-demo-project"

    In the several moment will get the new project which is located in the my-demo-project. It already has a application structure and the base classes ready to tunning-up for the project purposes.

    Step 2.

    Before continue need to make database migration (made before and and provide the access in the core/config/db.php). To do that type the next commands in the console:

    Code:
    cd/var/www/my-demo-project/applications/backend/protected
    php yiic migrate
    Step 3.

    Configuring the administration panel.

    In the new project, you will need to generate a model for the required tables with Gii Tool. Its settings placed in the file/core/config/main.php. During the model generation set the path for them «core.models»

    Basic settings for CRUD and models are in the file backend / protected / controllers / SiteController.php, the function reconfigureEntityParamsDictionary. In my demo-project this function looks like:


    Code:
    self::$entityConfigDictionary = CMap::mergeArray(
           parent::$entityConfigDictionary, array(
               'user' => array(
                    'modelName' => 'User',
                    'excludeFromGridView' => array(
                        'password', 'salt',
                    ),
                    'excludeFromDetailView' => array(
                        'password', 'salt',
                    ),
                    'modelAlias' => 'Blog User',
                    'modelAliasPlural' => 'Blog Users',
                    'bool' => array('admin'),
                    'datetime' => array('creation_date'),
                    'images' => array('image'),
                    'title' => 'username',
                    'link' => array(
                        'fb_link' => 'http://www.facebook.com/profile.php?id={value}'
                    ),
                    'password' => array('password'),
                    'dropDown' => array(
                        'role' => array(
                            1 => 'Publisher',
                            2 => 'Moderator',
                            3 => 'Writer',
                        ),
                    ),
                    'maxUploadedImageSize' =>
                        array('width' => 200, 'height' => 200),
                    'selectable' => 2,
                    'nuke'=>true
                ),
                'post' => array(
                    'modelName' => 'Post',
                    'notUseTitleOfRelation' => array('author'),
                ),
                'postCategory' => array(
                    'modelName' => 'PostCategory',
                    'linksManyToManyRelation' => array('post', 'category')
                ),
                'category' => array(
                    'modelName' => 'Category',
                    'modelAliasPlural' => 'Categories',
                ),          
            ));
        }
    Thant all.

    Each key in the array (User, Post, etc.) - the name of the entity. The settings description you may find here.
    Properly configured entities will help you not to create manually the CRUD for them, also haven't to edit the model.
    The webservice placed in the folder apllication/webservice. It contains base API class where you may define API methods.

    Links:

    1) Detailed information about the project is available here

    2) Project documentation:

    Full list of documents
    Documentation for the API
    Deploying code


    3) What and where to download:

    Backvendor
    Demo-version
    Code PHP:
     

  2. #2
    SitePoint Member
    Join Date
    Sep 2012
    Location
    Charkow, Kharkivs'Ka Oblast', Ukraine, Ukraine
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Find some new topics on this case in LinkedIn http://www.linkedin.com/groups/PHP-D...trk=anet_ug_hm

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •