Phalcon 2 released!

The wait is over! Phalcon 2.0 is here!

After more than a year of development, we’re extremely excited to announce the release of Phalcon 2.0 (final).

Those that have been following the project closely, know that this has not been a small feat.

  • We had to create a brand new language Zephir which allows developers to write PHP extensions easily.
  • We had to completely rewrite most of Phalcon 1.3.x, offering the same functionality as before so as to ensure that upgrading will be very easy.
  • Zephir had to be adjusted and enhanced as we moved through the rewrite, offering more functions and options to developers.
  • Additional features were implemented for 2.0, mostly thanks to our contributors!
The results are something that we are very proud of:
  • Phalcon 2.0, offering compatible functionality (and more) as before
  • Zephir, allowing developers to write their own extensions easily without the need to know C.

Installation

This version can be installed from the 2.0.0 branch, if you don’t have Zephir installed follow these instructions:

git clone http://github.com/phalcon/cphalcon
git checkout 2.0.0
cd ext
sudo ./install

The standard installation method also works:

git clone http://github.com/phalcon/cphalcon
git checkout 2.0.0
cd build
sudo ./install

If you have Zephir installed:

git clone http://github.com/phalcon/cphalcon
git checkout 2.0.0
zephir build

Note that running the installation script will replace any version of Phalcon installed before.

Windows DLLs are available in the download page.

See the upgrading guide for more information about installing and updating to Phalcon 2.

What’s next

Our release schedule will be every one or two months (unless we need to issue a security fix, which will be near instant). The target will be the most requested features by the community, although with Zephir contributing to Phalcon will be a breeze. We can’t wait to see those pull requests coming in :)

Smaller changes and fixes that can be bundled in a minor version will be released as soon as we can. We will also be working on a LTS (Long Term Support) model for our community.

Finally we are going to start the research on PHP 7, so that we can adjust Zephir accordingly and of course Phalcon. This task will require a lot of preparation and work but we have our targets set on it due to the new functionality and features it offers.

Conclusion and acknowledgments

We are super excited about this release and are looking forward to the future. A big thank you to all the contributors and donors! We could not have done this without you. And of course, we would like to thank everyone that tested the alpha, betas and release candidates and finding, filing issues and providing feedback. We really hope you enjoy this release.

We would like to express our deep gratitude for tremendous efforts migrating and testing the code in this version, specially to:

Thanks again to all!
Enjoy Phalcon 2 <3

6 PHP Libraries For HTTP And Scraping Websites

6 PHP Libraries For HTTP And Scraping Websites

PHP has steep learning curve. PHP is not the easiest option out there to code web project but, there is no other alternative to developers. It is popularly used by web developers for web projects. People are eager to find every reason to hate PHP but, it is the perfect language when it comes to simple freelance project. You can avoid built-in API wrappers and use HTTP in code. Today we have…

View On WordPress

PHP is a scripting language, especially suited for web development. As you can see majority of website around the world are based on PHP programming language. This PHP frameworks are packed with some amazing features which help us to develop the application easily and more efficiently. PHP framework provides a base foundation which make it more comfortable as compare to core PHP.

php

So I’ve been messing around with php a little. Coming from Java, I find the syntax very unattractive (a $ before every variable? really?), but I also find the language pleasantly concise. It reminds me of python in that I can get a small program up and running with minimal boilerplate compared to the verbosity of an equivalent Java solution. But I guess that’s the point of scripting languages. Anyway, from what I’ve tried so far, it’s not so bad. The lack of object orientation makes me afraid to attempt anything larger than even the smallest scripts, but I think i might stick with this language for scripting from now on. It seems extremely easy to deploy given its concision and web-based nature.

PHP: Google App Engine で Hello World

SSL によるフォームのデモアプリを公開するために Google App Engine も試してみた。ダウンロードの案内ページから SDK をダウンロードしてインストール。次にWeb コンソール画面からプロジェクトを生成する。プロジェクトの id がサブドメインに使われる。Gmail などで使われている文字列は利用不可能で、後から修正できない。

今度はローカルでプロジェクトをつくろう。 さきほどインストールした GoogleAppEngineLauncher を起動させて、File -> New Application からプロジェクトのひながたをつくる。Application ID は先ほど Web コンソールつくったものを指定する。Runtime は「PHP」を指定する。PHP 5.5 を利用したいので、 app.yaml の runtime の行を修正した。

runtime: php55

HTTP のアクセスを禁止するには secure の項目を追加する。

- url: .*
  script: main.php
  secure: always

編集が終わったら「Deploy」ボタンを押すと、ブラウザーが立ち上がり、認証が求められる。デプロイが終わったら「https://your-project-id.appspot.com/」にアクセスして確認する。ターミナルからデプロイするには次のコマンドを実行する。

appcfg.py --oauth2 update your-project/

app.yaml の version の行を変更した場合、デプロイしてもそのままでは反映されない。Web コンソール画面の「App Engine -> バージョン」の項目をたどり、デフォルトで使うバージョンを切り替える必要がある。

Composer を使ってライブラリをデプロイすることもできる。たとえば、Silex を使ってみよう。次のコードを composer.json として保存し、composer install を実行する。

{
    "require": {
        "silex/silex": "~1.2"
    }
}

app.yaml の script で指定した PHP スクリプトを次のように修正する。

require_once __DIR__.'/vendor/autoload.php';

use Symfony\Component\HttpFoundation\Response;

$app = new Silex\Application();
$app['debug'] = true;

$app->get('/', function () use ($app) {
    return 'Hello World';
});

$app->get('/about', function () use ($app) {
    return 'about';
});

$app->error(function (\Exception $e, $code) {
    return new Response('ページが見つかりませんでした。');
});

$app->run();

アプリケーションをデプロイしよう。

appcfg.py --oauth2 update your-project/

Position: WordPress Troubleshooter


Reverted back original ‘Barachiel Enterprises’ website using ‘DB Backup’ file, resetted every url & image links for whole site, tested site with some products.

Argh....
  • $content .= "
  • [LAB]
  • megjegyz1=" . substr($order->shipping_comment, 0, 70) . "
  • megjegyz2=" . substr($order->shipping_comment, 70, 140) . "
  • megjegyz3=" . substr($order->shipping_comment, 140, 210) . "
  • megjegyz4=" . substr($order->shipping_comment, 210, 280) . "
  • megjegyz5=" . substr($order->shipping_comment, 280, 350);
Guide: Upgrading to Phalcon 2

Phalcon 2 is the a major upgrade to the framework and will be released April 17th, 2015. This new version is a rewriting of about 85% total code from C to a high-level language we have created called Zephir.

Upgrading to the latest version has several benefits:

  • New features and improvements are added and bugs are fixed
  • Upgrading to the latest release available makes future upgrades less painful by keeping your code base up to date
  • Older version of Phalcon will eventually no longer receive bugs, security or feature updates

If you’re upgrading an existing application, it’s a great idea to have good test coverage before going in. You should also first upgrade to Phalcon 1.3.4 in case you haven’t and make sure your application still runs as expected before attempting an update to Phalcon 2.

Most of the development of Phalcon 2 has been focused on maintaining backwards compatibility with 1.3 and thus make the upgrade as easy as possible. However being a different version with many internal changes, existing applications may require some minor changes. Here are some things to consider to help make your upgrade process as smooth as possible.

Interfaces and parameter types
Phalcon 1.3 sometimes does not validate data types and interfaces compliance in parameters with the rigourousness as Phalcon 2 does. In many cases this should not be a problem. If you’re implementing your own adapters or components based on Phalcon’s interfaces then will be necessary to update the method prototypes:

use Phalcon\Di\InjectionAwareInterface;

class MyComponent implements InjectionAwareInterface
{
	public function setDi($di)
	{

	}
}

Must be changed to:

use Phalcon\DiInterface;
use Phalcon\Di\InjectionAwareInterface;

class MyComponent implements InjectionAwareInterface
{
	public function setDi(DiInterface $di)
	{

	}
}

If for any reason, a wrong type is passed to methods that are not suppose to, you will probably have to change it:

// Passing a number as route ???
$app->add(100, function() {
	// ...	
})

Must be changed to:

// Passing a number as route ???
$app->add("100", function() {
	// ...		
})

Protected methods
To improve performance some protected methods have been marked as final. It is a good practice not to override these methods as these might change in this or future versions and break applications.

Dependencies
In most cases it will be necessary to upgrade to the latest version of your dependencies as well. If the Phalcon version was recently released or if some of your dependencies are not well-maintained, some of your dependencies may not yet support the new Phalcon version. In these cases you may have to wait until new versions of your dependencies are released.

PHP compatibility
Like Phalcon 1.3, Phalcon 2.0 requires PHP 5.3.21 or above, however we will no longer deliver Windows DLLs for 5.3.x as it is considered an outdated and obsolte version. Additionally, you should know that many performance improvements have been particularly focused on PHP 5.6, so if you want to get the best performance we recommend to use this version.

Installation

This version can be installed from the 2.0.0 branch, if you don’t have Zephir installed follow these instructions:

git clone http://github.com/phalcon/cphalcon
git checkout 2.0.0
cd ext
sudo ./install

The standard installation method also works:

git clone http://github.com/phalcon/cphalcon
git checkout 2.0.0
cd build
sudo ./install

If you have Zephir installed:

git clone http://github.com/phalcon/cphalcon
git checkout 2.0.0
zephir build

Note that running the installation script will replace any version of Phalcon installed before.

Windows DLLs are available in the download page.

Deployment
When you are sufficiently confident your application is working with Phalcon 2, you’re ready to go ahead and deploy your upgraded Phalcon project.

Happy Upgrading!