In this tutorial I am showing how to install aura framework project v2 via composer.
composer create-project -s beta aura/framework-project path-to-project Aura.Framework_Project helps you to build web and cli applications.
If you need only web based application then Aura.Web_Project is what you need.
{% showterm b971330ea7fd28d22e2f3 %}
If you need only cli, then Aura.Cli_Project helps you.
Some of the recent discussions in the PHP world are
The Tribal Framework Mindset
Decoupling your packages from your framework
You don’t need a framework
Frameworks for everyone
Framework is not a bad idea # If you don’t use a framework, probably you will be using a bunch of independent libraries glued together or some code which help you to achieve your task.
In my earlier post I mentioned about adding a composer.json in the root of the github repo.
Sometimes you may see a non composer.json repo or some times people reject it, you still can do like the below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 <?php { "minimum-stability": "dev", "repositories": [ { "type": "package", "package": { "name": "ryancramerdesign/process-export-profile", "version": "1.0.0", "source": { "url": "https://github.com/ryancramerdesign/ProcessExportProfile", "type": "git", "reference": "master" }, "type": "pw-module", "require": { "hari/pw-module": "~1.0" } } } ], "require": { "ryancramerdesign/process-export-profile": "1.0.0" } } And run
I am a huge fan of composer. PW ( ProcessWire) is missing one of the good parts of composer. So here is a new installer to install the 3rd party modules of PW via composer.
If you have created a module for PW, what you need to do is add a composer.json file in your github repo and add it to packagist. An example composer.json is
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 { "name": "vendor/package-name", "type": "pw-module", "description": "Your module what it does", "keywords": [ "keywords", "comma", "seprated"], "homepage": "https://github.com/harikt/Assets", "license": "BSD-2-Clause", "authors": [ { "name": "Assets Contributors", "homepage": "https://github.com/harikt/Assets/contributors" } ], "require": { "php": ">=5.3.0", "hari/pw-module": "~1.0" } } Note the minimum requirement is PHP 5.3 for composer is 5.3 .
Processwire is a content management framework.
I was looking to change the directory structure of the Processwire.
1 2 3 4 5 |-- index.php |-- installer.php |-- README.md |-- site `-- wire I am not the first person to talk on the subject. There are other threads like Installation paths and moving folders, Common practices
Anyway I thought of trying the same and for serving the js, css, images I wrote my first processwire module Assets
2 days back Paul M Jones wrote an awesome post A Peek At Aura v2 – Aura.Dispatcher the idea behind Aura.Dispatcher and how it was born.
So today, let us try to integrate Aura.Dispatcher with Silex. This post is inspired by the comment made by Luis Cordova. Thank you.
1 2 3 composer create-project silex/silex --no-dev silexproject cd silexproject composer require aura/dispatcher dev-develop-2 I hope you have composer installed else get composer.
I am not going to explain each and everything, the code is self explanatory. You can move the classes according to your wish (may be to another folder). I am trying to show a simple use case.
If you have noticed recently, there have been tons of commits from Paul M Jones for aura version 2.
More standalone repos born. Everyone should try and give feedback as much as possible.
Interesting stuffs split from Aura.Sql v 1.3 are
Extended PDO,
As the name says, it is an extended version of PDO. Good thing is it is PHP 5.3 compatible.
If you have worked with PDO you know the good and bad. One of the difficulty is, it cannot use an array for an in clause.
It is a great feeling, and one of the happiest moment in my life when aura releases its stable framework.
Aura is one of my first framework, which helped me to learn the inner working of a framework, how to create a framework, rather than playing with full stack framework.
If you are interested to learn or contribute in the next version of Aura join the group.
Some days back I wrote about a WIP of The Book on Aura
It got some attention and pull requests.
Akihito Koriyama have already started to convert the documentation to Japanese.
And today I am happy to announce that it is officially going to the manuals.
Contributing # Fork https://github.com/auraphp/auraphp.github.com and contribute to the manuals.
The manuals are in different languages. Currently
Akihito Koriyama is working on Japanese translation.
In my earlier post I have shown how you can connect to Magento with REST api. In this post let us connect via SOAP.
The below class acts like a proxy to call the magento soap api.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 <?php /** * * @author Hari K T * */ class My_Soap_Magento { /** * * Host name to connect * * @var string * */ protected $hostname; /** * * User name * * @var string * */ protected $username; /** * * API Key * * @var string * */ protected $apikey; /** * * Zend_Soap_Client * * @var Zend_Soap_Client * */ protected $client; protected $session; /** * * Constructor * * @param string $hostname The host name * * @param string $username The user name of the host * * @param string $apikey The apikey of the host * */ public function __construct($hostname, $username, $apikey) { $this->hostname = $hostname; $this->username = $username; $this->apikey = $apikey; } /** * * Magic method, the methods are named on the basis of Magento SOAP api * You don't need to pass the session as the first argument, for convience. * * @link http://www.magentocommerce.com/api/soap/introduction.html * * @param string $function * * @param mixed $args * * @return string | null * */ public function __call($function, $args) { $session = $this->getSession(); $params = array_merge(array($this->getSession()), $args); $result = call_user_func_array(array($this->getClient(), $function), $params); if ($result) { // I need to get as json return Zend_Json_Encoder::encode($result); } return null; } /** * * Get the session from logging in to the Magento server * * @return string * */ public function getSession() { if (! $this->session) { try { $this->session = $this->getClient()->login($this->username, $this->apikey); } catch (Exception $e) { } } return $this->session; } /** * * If we already have a session, we can set the session so it don't * need to login again and get the session. This helps to reduce the * call for login . * * @see getSession() * * @param string $session * * @return IM_Soap_Magento * */ public function setSession($session) { $this->session = $session; return $this; } /** * * Get the Zend_Soap_Client object * * @return Zend_Soap_Client * */ public function getClient() { if (! $this->client) { $endpoint = trim($this->hostname, '/') . '/api/v2_soap/?wsdl'; $this->client = new Zend_Soap_Client( $endpoint ); } return $this->client; } } In order to connect you want to create an object of the above class My_Soap_Magento. You need to get the username and api key from the magento host.