The Killer Mind

The Killer Mind

Breaking

Thursday, November 5, 2015

Install Magento 2 using Composer

6:00 PM 0
Install Magento 2 using Composer
If you’re new to Composer or package managers like Node’s NPM then you’ve got a lot to take in before you start working with Magento 2. You see, Magento 2 is dependent on Composer and all of its package/dependency goodness.
It’s true that Magento and several other developers have written articles detailing what I’m about to go through, but I decided to write this for the absolute beginner with deeper explanation of what is going on throughout the steps – particularly the role of Composer.

STEP 1: SERVER ENVIRONMENT

Magento 2 has new minimum requirements of your LAMP stack. I’m not going to list them here in case they change so please check the Magento 2 documentation for those prerequisites. A Vargrant setup is preferable but MAMP Pro can also work.

STEP 2: COMPOSER

If you’re unaware of what composer is then try this analogy. Composer is exactly like…. a composer. In this case Magento 2 is a musical and the packages installed are the members of the orchestra. Once installed in your project, Composer can be used to manage packages based on its dependency system. You can’t have a live musical without the orchestra and you can’t have Magento 2 without its packages. In both cases the composer is responsible for assembling components to allow the rest to work.
Fire up your command line tool and navigate to an empty folder where you’d like to install your copy of Magento 2. We need to ensure Composer is installed globally on your system so that you don’t have to repeat this step again.
Type the following command to see if composer is installed:
?
1
composer -help
If it’s not installed you’ll see the response command not found, which means you need to install Composer. Luckily it’s as simple as running the following two commands:
?
1
2
mv composer.phar /usr/local/bin/composer
The first command installs Composer into your local directory, the second will move the composer.phar file to a directory where it can be accessed globally by your system.
If you run the original command again you should see that Composer is installed and ready:
Install Composer

STEP 3: CLONE MAGENTO 2

To clone Magento CE 2 into your current directory run the Git following command:
It will clone the repo into a magento2 subdirectory, and this should take about 2-3 minutes depending on your broadband speed. Once it’s done run the following command to move into the Magento 2 root directory and checkout the master branch.
?
1
2
cd magento2
git checkout master
In order to work with Composer a project must have a composer.json file within its root directory. If you take a look at the file you’ll see a huge list of Magento 2 package dependencies. I’ve picked out first three below:
  • require: a list of packages (and versions) required by Magento 2. Magento 2 will not install if  any of those package dependencies are not met.
  • require-dev: a list of packages required by Magento 2 for development (includes running units tests, hence why PHPUnit is in there)
  • replace: shows a list of packages that are replaced by Magento 2, which is mostly made up of the main modules that make up the Magento 2 framework – this allows developers to fork specific packages with improved or customised code
To run Composer for the first time and install your packages simply run:
?
1
composer install
When upgrades become available you can install future updates by using:
?
1
composer update
The beauty is that upgrades will only run if Composer identifies a package’s dependencies can be met meaning the stack should always run smoothly.
Vagrant users should not find this a problem, however you may encounter missing PHP extensions when you install Composer, such as:
  • The requested PHP extension ext-mcrypt * is missing from your system.
  • The requested PHP extension ext-intl * is missing from your system.
For MAMP users, you can get around this by creating a symlink of your system’s PHP version to MAMPs. Firstly find out your PHP location:
?
1
which php // returns for example: /usr/bin/php
And then create the symlink:
?
1
2
sudo mv /usr/bin/php /usr/bin/php.bak
sudo ln -s /Applications/MAMP/bin/php/php5.6.10/bin/php /usr/bin/php
When Composer has finished its install you’ll be ready to install Magento. You can do this via command line, with Composer or through the installer interface.

STEP 4: INSTALL MAGENTO 2

The installer interface is better looking than before and it checks your server ‘readiness’ before allowing you to proceed with the install.
Magento Install

how to Integrate Social Media into WordPress

5:58 PM 0
how to Integrate Social Media into WordPress
Social media is an everyday part of our lives. Everywhere you turn you see people on their phones/tablets/computers Facebooking, Tweeting, Instagram-ing & more!
Social media has made everything so much more accessible these days, that if you’re not using it you can fall behind very quickly (and I’m not just talking about the web). Within minutes of something happening, it can be shared around the World for people to see/read/interact with. For this reason, I believe that it is something that should be seriously considered for integration on any website, not just WordPress. Unless you’re a regular reader of the Creare Tech Blog, I’d be willing to bet that you’re reading this post from a link you saw on social media?
If you’re unsure whether you’ve got social media integrated within your website, or even wonder what level of social media integration your website has, you can use our FREE digital healthcheck tool.

How can I utilise social media on my WordPress website?

So I wanted to cover a few ways you can integrate social media into your WordPress website.
There a ton of pros to why you should do this and not too many cons to be honest. One of the main pros is the fact that you could have access to share your content with this massive network of people. I read a blog post not too long ago which said that out of the 7 billion people in the world, nearly 2.1 billion of these have social media accounts.
Out of the 7 billion people in the world, nearly 2.1 billion of these have social media accounts
I guess it depends on your website and the content on there as to which social media integration method you go for. You could split this into a few different categories which I’ll cover below:

Like/Follow Buttons

If you don’t know what I mean by ‘like/follow’ buttons, then hopefully the below will clear it up.
Example of some Like buttons
These are the generic buttons to ‘like’ or ‘follow’ your business. So these buttons won’t actually share content, but will get people to interact with your company social media pages. If you don’t have any content you want users to interact with and share, then these buttons are a good fit for your website. You still get social media interaction and can raise awareness for your business.

Share Buttons

You’re probably a lot more familiar with Share buttons; they come in all shapes and sizes. Below are just a few examples.
Example of share buttons
These kind of buttons are great to add to content areas on your website. This could be anything from graphics to page content, but most popular are blog posts. This gets users sharing specific content on your website and can drive traffic to individual posts/pages if links are followed.

Feeds

Feeds/embedded timelines can also be a good method of social media integration. If a user stumbles across your website and you have one of these feeds in the sidebar or footer for example, the user can quickly flick through your latest tweets/posts. You could pick up a new follower or even have one of your latest tweets/posts re-shared.
Example of social media feeds

Integration methods

If you’ve seen the example, you may be thinking of how you can get this on to your website. Well this next bit is for you;
There’s 2 ways:
  • Install a plugin
  • Use the developer API’s to integrate a standard/custom button

Using a plugin

If you search on wordpress.org/plugins/ for the term ‘social media’, you get a plethora of results. There’s so many plugins out there to help, here are just a few I’ve used in the past.

Advanced Twitter Feed Integration

Advanced Twitter Feed Integration
A little bit of shameless self-promotion. Here’s an easy to use plugin we made here @creare for integrating Twitter into your website.

Add to Any

Add to any
A popular sharing tool, similar to AddThis or ShareThisAddToAny have created their own WordPress plugin.

Floating Social Media Icon

Floating Social Media Icon Pkugin
A plugin which comes highly recommended, it’s simple & easy integration allows you to be up and running in no time at all.

Nextscripts Auto Poster

Nextscripts plugin
This is a great little plugin which auto-posts content once you’ve published it! It currently supports all the big social media platforms and they have plans to include more.

Developer API’s

It’s not unheard of that these big social media companies provide an API. I’m not going to go into what an API is today, but here’s a definition from Google:
a set of functions and procedures that allow the creation of applications which access the features or data of an operating system, application, or other service.
Here’s a couple of the big social media companies API’s:
These API’s provide a lot of documentation on how you can add these buttons & feeds into your website, all in really easy to follow guides. They also provide code to copy & paste which can make things easier!
Using the API’s you can integrate a standard button or feed, but you also have the ability to make your own sharing widget. We built the sharing widget on our own site using the API’s & you can see that the styling is different from the standard buttons:
Standard vs Branded buttons
It makes the experience a little more personalised in a way. If you’re going to make your own buttons, try and make sure they are really obvious as to what they are. Users are used to seeing the standard buttons and you don’t want to lose interaction by customising them so much that they can’t be recognised.

TO SUMMARISE

There are plenty of ways to integrate social media into your website, whether you use a plugin or completely customise the integration.
I’d love to hear how you’ve integrated social media into your website, please comment below.

Daily News