Dash is an API Documentation Browser and Code Snippet Manager. Dash searches offline documentation of 200+ APIs and stores snippets of code. You can also generate your own documentation sets. PhpStorm is an amazing IDE for PHP that has become very popular among developers lately. This screencast will cover the major integration points needed to have an enjoyable experience. The first point is the Phalcon Developer Tools integration, it’s easy to run commands from the IDE and work on the results immediately. PhpStorm is written in Java. Users can extend the IDE by installing plugins created for PhpStorm or write their own plugins. The software also communicates with external sources like XDebug. All features available in WebStorm are included in PhpStorm, which adds support for PHP and databases. PhpStorm已经是集成度很高的php开发的IDE了,但是个别插件可以起到如虎添翼的作用 CodeGlance(叫minimap更恰当) 让phpstorm支持sublim. Fossapps/PhpStorm-Phalcon-Autocomplete is licensed under the GNU General Public License v2.0. The GNU GPL is the most widely used free software license and has a strong copyleft requirement. When distributing derived works, the source code of the work must be made available under the same license.
These tools are a collection of useful scripts to generate skeleton code. Core components of your application can be generated witha simple command, allowing you to easily develop applications using Phalcon.
Download¶
You can download or clone a cross platform package containing the developer tools from Github.
Installation¶
These are detailed instructions on how to install the developer tools on different platforms:
Getting Available Commands¶
You can get a list of available commands in Phalcon tools by typing: phalcon commands
Generating a Project Skeleton¶
You can use Phalcon tools to generate pre-defined project skeletons for your applications with Phalcon framework. By default theproject skeleton generator will use mod_rewrite for Apache. Type the following command on your web server document root:
Phpstorm Phalcon Support
The above recommended project structure was generated:
You could add the parameter –help to get help on the usage of a certain script:
Phalcon DevTools (1.2.3)
--name | Name of the new project |
--enable-webtools | |
Determines if webtools should be enabled [optional] | |
--directory=s | Base path on which project will be created [optional] |
--type=s | Type of the application to be generated (micro, simple, modules) |
--template-path | |
Specify a template path [optional] | |
--use-config-ini | |
Use a ini file as configuration file [optional] | |
--trace | Shows the trace of the framework in case of exception. [optional] |
--help | Shows this help |
Phalcon Phpstorm Integration
Accessing the project from the web server will show you:
Generating Controllers¶
The command “create-controller” generates controller skeleton structures. It’s important to invoke this command inside a directorythat already has a Phalcon project.
The following code is generated by the script:
Preparing Database Settings¶
When a project is generated using developer tools. A configuration file can be found in app/config/config.ini To generate modelsor scaffold, you will need to change the settings used to connect to your database.
Change the database section in your config.ini file:
Generating Models¶
There are several ways to create models. You can create all models from the default database connection or some selectively. Modelscan have public attributes for the field representations or setters/getters can be used.
--name=s | Table name |
--schema=s | Name of the schema. [optional] |
--namespace=s | Model’s namespace [optional] |
--get-set | Attributes will be protected and have setters/getters. [optional] |
--extends=s | Model extends the class name supplied [optional] |
--doc | Helps to improve code completion on IDEs [optional] |
--directory=s | Base path on which project will be created [optional] |
--force | Rewrite the model. [optional] |
--trace | Shows the trace of the framework in case of exception. [optional] |
--mapcolumn | Get some code for map columns. [optional] |
The simplest way to generate a model is:
All table fields are declared public for direct access.
By adding the –get-set you can generate the fields with protected variables and public setter/getter methods. Those methodscan help in business logic implementation within the setter/getter methods.
A nice feature of the model generator is that it keeps changes made by the developer between code generations. This allows theaddition or removal of fields and properties, without worrying about losing changes made to the model itself.The following screencast shows you how it works:
Phpstorm Phalcon Crack
Scaffold a CRUD¶
Scaffolding is a quick way to generate some of the major pieces of an application. If you want to create the models, views, andcontrollers for a new resource in a single operation, scaffolding is the tool for the job.
Once the code is generated, it will have to be customized to meet your needs. Many developers avoid scaffolding entirely, optingto write all or most of their source code from scratch. The generated code can serve as a guide to better understand of how theframework works or develop prototypes. The screenshot below shows a scaffold based on the table “products”:
The scaffold generator will build several files in your application, along with some folders. Here’s a quick overview of what will be generated:
File | Purpose |
---|---|
app/controllers/ProductsController.php | The Products controller |
app/models/Products.php | The Products model |
app/views/layout/products.phtml | Controller layout for Products |
app/views/products/new.phtml | View for the action “new” |
app/views/products/edit.phtml | View for the action “edit” |
app/views/products/search.phtml | View for the action “search” |
When browsing the recently generated controller, you will see a search form and a link to create a new Product:
The “create page” allows you to create products applying validations on the Products model. Phalcon will automatically validatenot null fields producing warnings if any of them is required.
After performing a search, a pager component is available to show paged results. Use the “Edit” or “Delete” links in front of each result to perform such actions.
Web Interface to Tools¶
Also, if you prefer, it’s possible to use Phalcon Developer Tools from a web interface. Check out the following screencast to figure out how it works:
Integrating Tools with PhpStorm IDE¶
The screencast below shows how to integrate developer tools with the PhpStorm IDE. The configuration steps could be easily adapted to other IDEs for PHP.
Conclusion¶
Phalcon Developer Tools provides an easy way to generate code for your application, reducing development time and potential coding errors.
Developer(s) | Andres Gutierrez and others |
---|---|
Initial release | November 14, 2012[1] |
Stable release | |
Preview release | 4.0.0 / 21 December 2019; 15 months ago[3] |
Repository | Phalcon Repository |
Written in | Zephir, C, PHP |
Platform | Unix, Linux, Mac OS X, Windows[4] |
Type | Web application framework |
License | BSD License[5] |
Website | phalcon.io/en-us/ |
Phalcon is a PHPweb framework based on the model–view–controller (MVC) pattern. Originally released in 2012, it is an open-source framework licensed under the terms of the BSD License.
Unlike most PHP frameworks,[citation needed] Phalcon is implemented as a web serverextension written in Zephir and C, aiming to boost execution speed, reduce resource usage, and handle more HTTP requests per second than comparable frameworks written primarily in PHP. One drawback of this approach is that root/administrative access is required on the server to install Phalcon by building a custom binary or using a precompiled one.[6]
History[edit]
Phalcon was created by Andrés Gutiérrez and collaborators looking for a new approach to traditional web application frameworks written in PHP. The original draft of the framework in 2011 was called 'Spark',[7] the name was later changed to Phalcon, representing the words 'PHP' and 'falcon'. Phalcon's initial release was made available on November 14, 2012.
Phalcon 0.3.5 includes an ORM written in C, MVC components, and cache components. This release was followed by the Phalcon 0.5.0 that brought a high-level dialect of SQL called PHQL, and Phalcon 0.6.0 that introduced Volt, a template engine similar to Jinja. Phalcon 1.0 was released on March 22, 2013.[8] with Phalcon 1.3 being the last minor release in that series. Phalcon 2.0 saw most of the project ported from C to Zephir.
Phalcon 3.0.0 was released on 29 July 2016,[9] this major release includes support for PHP 7 as well as being Phalcon's first LTS (Long Term Support) release. Phalcon also adopted SemVer for their next releases versioning.
Phalcon 4.0.0 was released on 21 December 2019,[10] this major release includes support for PHP 7.2, 7.3 and 7.4 has Stricter Interfaces and support PSR-3, PSR-7, PSR-11 (proxy), PSR-13, PSR-16, PSR-17.
On 19 August 2020,[11] it was announced that Serghei, the core contributor on the Zephir language was stepping down from the project, thus leaving the language in an unmaintained state. The Phalcon Team decided to abandoned the language and port the framework over to a native PHP application for Version 5. Version 5 will be the first version of Phalcon to support PHP 8.
A Phalcon Hangout on 6 September 2020[12] announced that work has started on Phalcon 5. With this announcement, the projects new repositories were officially made public.
See also[edit]
- Phalcon Slayer – a wrapper that restructures the Phalcon framework
References[edit]
- ^'Release Version 0.4.5 · phalcon/cphalcon'. github.com. 2012-11-14. Retrieved 2015-03-09.
- ^'Release Version 4.0.6 · phalcon/cphalcon'. github.com. 2020-05-16. Retrieved 2020-05-16.
- ^'Release Version 4.0.0 · phalcon/cphalcon'. github.com. 2019-12-21. Retrieved 2019-12-21.
- ^'Download Phalcon for Linux/Unix/Mac'. phalcon.io.
- ^'cphalcon/LICENSE.md at master · phalcon/cphalcon · GitHub'. GitHub.
- ^Lukasz Kujawa (2013-05-09). 'Is Phalcon the promised land for PHP?'. systemsarchitect.net. Retrieved 2015-03-14.
- ^'Interview with PhalconPHP Creator Andrés Gutiérrez'. phalcon.io. 2015-05-19. Retrieved 2015-05-23.
- ^'CHANGELOG-1.x.md at master'. github.com. 2017-08-06. Retrieved 2018-12-19.
- ^'Phalcon 3.0.0 released - Phalcon Framework'. phalcon.io. 2016-07-29. Retrieved 2016-07-29.
- ^'Phalcon 4.0.0 released - Phalcon Framework'. phalcon.io. 2019-12-21. Retrieved 2019-12-21.
- ^Team, Phalcon (2020-08-19). 'The Future of Phalcon'. Phalcon Blog. Retrieved 2020-09-25.
- ^Team, Phalcon (2020-09-04). 'Community Hangout and Update - 2020-09-06'. Phalcon Blog. Retrieved 2020-09-25.