Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Laravel 5.x Cookbook
Laravel 5.x Cookbook

Laravel 5.x Cookbook: A recipe-based book to help you efficiently create amazing PHP-based applications with Laravel 5.x

eBook
€8.99 €32.99
Paperback
€41.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Laravel 5.x Cookbook

Chapter 1. Setting Up and Installing Laravel

In this chapter, we will cover the following topics:

  • Setting up Homestead
  • Setting up composer and PHP on your local machine for faster Workflows
  • Using .env for your local build
  • Using sequel pro and connecting to local and remote databases
  • Setting up your first application in Homestead
  • Setting up Gulp and Elixir

Introduction

In this chapter, we will cover installing and setting up Laravel and Homestead. As I have often said in this book, the online Laravel docs are great, and I will refer to them as needed. This book should be regarded as a complement to the official documentation, expanding on the explanations found there and adding some tips and tricks for everyday use. Also, I will show a number of shortcuts to help speed up your workflow. Finally, I will touch on Gulp and Elixir.

Setting up Homestead

This section will work off the existing Laravel docs to make sure your Homestead is set up correctly, as well as give you some background as to what is going on.

Getting ready

You will need a terminal application, access to the Git command, and decent Internet. As for the terminal on Mac, I suggest iTerm, available at https://www.iterm2.com/; it really is a nice tool for something you are going to use quite often. For Windows, git for Windows https://git-for-windows.github.io/ got me going quickly both for git and a Bash such as terminal. Linux has a nice terminal to begin with, and installing git is easy. As far as Vagrant and VirtualBox are concerned, I will link you to the related sites since they do a good job at explaining how to install each of them on your system.

How to do it...

The following are the steps to set up Homestead:

  1. First, install VirtualBox as noted on their site at https://www.virtualbox.org/wiki/Downloads.
  2. Once this is in place, install Vagrant from https://www.vagrantup.com/.

    At this point, Vagrant will be ready to use at the command line:

    How to do it...

    You will not really need to open VirtualBox.

    Tip

    For Windows users, this link helped me a lot to get started with Homestead: http://blog.teamtreehouse.com/laravel-homestead-on-windows.

  3. Make a folder in your home directory called Code with a capital C.

    On a Mac, this will look like—/Users/alfrednutile/Code.

  4. From here, the online docs do a great job of getting you going on the final Homestead installation and setup—https://laravel.com/docs/5.2/homestead.

How it works...

When done, you will have the Homestead.yml configuration information in the ~/.homestead folder to modify as needed. On Mac, this would be /Users/alfrednutile/.homestead/Homestead.yml.

Tip

Laravel Docs talk about shortcuts in the Daily Usage section at https://laravel.com/docs/5.2/homestead#daily-usage.

Also, you should have made a new folder called ~/Code to be the base folder for all your projects. For example, my folder looks like this:

  • /Users/alfrednutile/Code/app1
  • /Users/alfrednutile/Code/app2

You can have multiple applications within your code folder. In this example, app1 is the root folder for the app1 application, and app2 is the root folder for the app2 code. Keep in mind that the Vagrant box will later on mount this Code folder into the /home/vagrant/Code folder inside the Vagrant client.

Tip

I do my migration and PHPUnit work inside Homestead using the ssh shortcut that the online documents show you. But I do a lot of work outside Homestead inside the Code/app1 directory, such as all the Git commands and much of composer. This creates a much faster workflow for the file intense commands.

There's more...

You can, of course, manually set up your own machine for Nginx, PHP, MySQL, and all the rest, but there are a lot of reasons why the preceding one is best. On a team or alone, having your environment contained like this makes upgrading your machine, going from desktop to laptop, pushing code to production, having up-to-date libraries for new apps and older libraries for legacy apps, and more so much easier.

Setting composer and PHP on your local machine for faster Workflows

In this section, we will cover some tips on using PHP and composer outside of the Homestead box to help with your workflow.

Getting ready

As with the preceding sections, you will need to have a terminal and decent internet. I will cover this using a Mac, but Windows and Linux have their systems to install the software. By default, you can install Xcode on a Mac and get pretty far with PHP, but it tends to be an older version of PHP. Here, we will use Homebrew to install PHP 5.6. We will also use Homebrew later on in this book as well.

How to do it...

  1. Visit the http://brew.sh/ site, and run the command they show there to install Homebrew on your Mac.
  2. Follow the instructions at https://github.com/Homebrew/homebrew-php to get the PHP5.6 setup.
  3. After you are done with step 2, add to your ~/.bash_profile so that we can use this version of PHP:
    export PATH="$(brew --prefix php56)/bin:$PATH"
    
  4. Then, update your current session:
    >source ~/.bash_profile
    
  5. Then, we will make sure our PHP is set up properly:
    >which php
    

    You will see the/usr/local/opt/php56/bin/php output and type:

    >php –v 
    

    This will show that you are running 5.6.19 or a higher version.

  6. Set up mycrypt as follows:
    >brew install php56-mcrypt
    
  7. Then, we will install composer as seen at https://getcomposer.org/download/:
    >php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php
    >php -r "if (hash('SHA384', file_get_contents('composer-setup.php')) === 
    
    625196afcca95a5abf44391188c695c6c1456e16154c75a211d238cc3bc5cb47') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
    >php composer-setup.php
    >php -r "unlink('composer-setup.php');"
    >sudo mv composer.phar /usr/local/composer
    

Tip

What is ~/? That is shorthand for your Home directory. When I use this, for example, >source ~/.bash_profile, your operating system will know it is in your home folder, for example, /Users/alfrednutile/.bash_profile.

How it works...

That was a lot of steps! Let's cover what we did and why. We began by installing Homebrew to make installing packages easier. We will periodically need to install packages such as Wget, Webdriver, and more as we progress through this book. Using the brew command supplied by Homebrew makes installing these packages a snap.

Then, we used Brew to make sure we have a current version of PHP on our Mac. But considering we already have Homestead, why do this? There is some work you do outside of Homestead, for example, getting and installing Laravel using composer, running envoy, and more. And some of these you can run in Homestead, but you will see some speed difference outside of it. So, you still need it on your machine, but in this case, we are not so worried about it being the wrong version for one of our many applications.

The mcrypt part of the installation took care of the extension that we need to run common commands such as php artisan key:generate and other commands in Laravel.

We finalized the PHP setup with Bash shortcuts, so when we open the terminal, we are ready to use PHP and not the version that comes with Xcode on Mac.

We then use PHP to download and install composer, the biggest advancement in PHP since I started 15 years ago in my opinion, and you will see more of composer shortly.

Finally, we are ready to download Laravel!

There's more...

You could, of course, use Brew to install MySQL and more. But for now, we are going to leave all of this inside the Homestead box that we set up earlier.

Setting up your first application in Homestead

In this section, we will download Laravel and set up our local site to use for the rest of our recipes taking advantage of Homestead.

Getting ready

We have Homestead installed. My home folder called ~/Code is where we will be working.

How to do it...

  1. Type the following in the terminal:
    >cd ~/Code
    
  2. Then, download Laravel to a new folder:
    >composer create-project --prefer-dist laravel/laravel recipes 
    
  3. Move into the directory for your new application:
    >cd recipes
    
  4. Now we need to tell Homestead about our new application:
    >cd ~/.homestead && subl Homestead.yml
    
  5. Once the editor pops open, you can add your new site:
    How to do it...
  6. Under database:
    How to do it...
  7. Click on Save and close the editor.
  8. Then, start up Homestead or just provision it:
    >homestead provision
    

    You may be asked for a password, which is your system admin password and not the Homestead password.

  9. Then, we need to edit our system Host file (in this case, our local computer and not Vagrant and Homestead); this will again ask for our system password:
    >sudo subl /etc/hosts
    

    Tip

    I will show a shortcut command in the How it works… section.

  10. Next, edit the host file to set your recipes.dev domain right next to the default Homestead IP of 192.168.10.10; then, save and close the editor:
    How to do it...
  11. Then, visit your site at https://recipes.dev! You may get an SSL warning but click on Advanced and Proceed:
How to do it...

How it works...

The composer command that we ran gets Laravel from its database of applications and libraries at https://packagist.org/ then download it. We began by installing Homebrew to make installing packages easier. We will periodically need to install packages such as Wget, Webdriver, and more as we progress through this book. Using the brew command supplied by Homebrew makes installing these packages a snap.

I also used some shortcuts. One shortcut was subl, which was what you get when you install http://www.sublimetext.com/. But you can use whatever editor you want.

Using some of the preceding tips will make a shortcut called hedit adding to my ~/.bash_profile:

alias homesteadedit='cd ~/.homestead && subl Homestead.yml'

So, we are editing the main file that Laravel uses for all its Homestead settings. You will be here a lot, so shortcuts really pay off.

The same is applicable with the hostedit command that I used:

alias hostedit='sudo subl /etc/hosts'

Here, we are adding to our .bash_profile a quick way to edit the file and add the needed domain recipes.dev and save and exit. Now, when you visit https://recipes.dev, your operating system will know that it is really for Homestead.

See also

Using .env for your local build

This was one of the best changes to Laravel from version 4 and 5 in my opinion. When I was doing Ruby on Rails work, it also had this feature, and this is the key to help create an application that falls in the Twelve Factor App workflow. You will learn how to use this file for setting keys to some recipes later on in the book. In this example, we will start using it to set up our database.

For the rest of this book, I will use PHPStorm for my editor, which helped me a ton to explore Laravel and PHP code when I first started. Make sure your editor has plugins to easily click and explore classes.

Getting ready

When you installed Laravel, it copied the .env file into place. So, just open your editor of choice and open the application directory.

How to do it...

  1. Open .env in your editor.
  2. Alter the file as follows, so the database name and the URL match what we would put in our Homestead setup file:
    How to do it...

How it works...

First of all, this is a hidden file. The . in front of it makes it hard to see in File Managers and even the command line. When at the command line, ls -a * is how to show this hidden file. Most code editors or IDEs will show you these.

Also note that Laravel comes with a .gitignore file that includes this file:

How it works...

We will have to consider the addition or changes of any settings in env, as we push this application to Production for everyone to see when we are done. I will cover this more in Chapter 10, Deploying Your App.

So, what did we change in this file? Most of what you see was already there; we just set two things:

  • DB_DATABASE=recipes_local
  • APP_URL=https://recipes.dev

This is it, really! If you look back, this is what we set in the Homestead.yml file. You can see what we called the database and domain name. So now we need to tell our application what database table to use and which Homestead is made for us. Yeah, for Homestead!

See also

Using sequel pro and connecting to local and remote databases

Soon, we will be doing migrations, saving data to the database, and other day-to-day workflows, but sometimes, it is nice to look into the database. For example, you may want to export Production and the environment that has your live data down to local to review some bug. This section will show how to use Sequel Pro to do secure, over SSH, connections to your database. This allows you to get to your database with almost zero risk other than SSH.

How to do it...

The following are the steps to connect sequel pro to local and remote databases:

  1. Download and install Sequel Pro from http://www.sequelpro.com/.
  2. Add a new connection to Homestead:
    How to do it...
  3. Add new connection to a remote Host:
    How to do it...

How it works...

In the past, I have used phpMyAdmin, and it was better than just the command line. But Sequel Pro really was a game changer. For one, I did not have to install phpMyAdmin on my servers and risk issues related to security. Second, it is a good interface and makes it really easy to check out data, tables, do queries, and so on when needed.

So, what you saw previously was simply a setup for Homestead using the Standard tab and Port 33060, which is what Homestead forwards its MySQL port to.

When we deploy our first server, it will have SSH port 22 open, but never will I have MySQL open only on 127.0.0.1.

Tip

For the most part, you only want three ports open on your server: 22 for SSH, 80 to redirect web requests to SSL/HTTPS, and 443 to serve your website.

So, to connect to this we select the SSH tab, and enter the information for the database on the server, since we will be on the server after the SSH step. Then, we enter the information for SSH; in this case, I had to go into my home folder to use my SSH public key. If you did not set up a key on your server, then most likely, you are using a password, so enter that instead.

Tip

If you do not have the a.ssh folder in your Home directory (~/), then take a moment to create it. From the command line, run ssh-keygen –t rsa and just answer yes to all the questions. Do not add a password. You now have a public key.

It is really this simple. Now, you have this great UI to look into your database once in a while; though after using Laravel with php artisan migrate and eloquent, I am not in the database often.

See also

Setting up Gulp and Elixir

Elixir is new in Laravel 5.x and is a wrapper around Gulp, which is a well-known JavaScript build system. We will use it to manage assets later on in the book. For now, we just want to get it installed.

How to do it...

  1. SSH into Homestead:
    >homestead ssh
    >cd ~/Code/recipes
  2. Install Gulp using the following:
    >npm install
  3. When it is done, try the following:
    > node_modules/gulp/bin/gulp.js -v

How it works...

Once again, Homestead is making our work easier; NPM is already installed! So, we can use this to not only install Gulp but also other JavaScript libraries that we need. How to do this? If you look into the Laravel application that we downloaded, you will now see the =package.json file:

How it works...

This is the file that NPM uses, just as PHP uses composer.json, to know what to install. Here, it is getting Elixir, Gulp, and Sass for us. Elixir is new in Laravel 5.x and is a wrapper around Gulp, which is a well-known JavaScript build system.

Notice too that if you type which gulp, it is installed globally, thanks to Homestead again!

Elixir will come in later, but for now, note gulpfile.js that is right above the package.json file; this is where we will set up our asset workflow later on.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Leverage the amazing new features of Laravel 5.x to create cutting-edge responsive PHP applications.
  • Create apps with interoperability features and extend these features to your existing applications as well.
  • Over 60 recipes that combine tried and tested Laravel tips for getting your app working.

Description

Laravel is a prominent member of a new generation of web frameworks. It is one of the most popular PHP frameworks and is also free and an open source. Laravel 5 is a substantial upgrade with a lot of new toys, at the same time retaining the features that made Laravel wildly successful. It comes with plenty of architectural as well as design-based changes. The book is a blend of numerous recipes that will give you all the necessary tips you need to build an application. It starts with basic installation and configuration tasks and will get you up-and-running in no time. You will learn to create and customize your PHP app and tweak and re-design your existing apps for better performance. You will learn to implement practical recipes to utilize Laravel’s modular structure, the latest method injection, route caching, and interfacing techniques to create responsive modern-day PHP apps that stand on their own against other apps. Efficient testing and deploying techniques will make you more confident with your Laravel skills as you move ahead with this book. Towards the end of the book, you will understand a number of add-ons and new features essential to finalize your application to make it ready for subscriptions. You will be empowered to get your application out to the world.

Who is this book for?

The ideal target audience for this book is PHP developers who have some basic PHP programming knowledge. No previous experience with Laravel is required for this book.

What you will learn

  • Optimize Your Gulp and Elixir Workflow
  • Use Travis to run tests with every push
  • Build and test your view-based route in PHPUnit
  • Explore workflows for migrations and seeding
  • Implement Angular in your Laravel applications
  • Set up a user authentication system
  • Integrate the new Billing library and Stripe in your Laravel application
  • Use the Artisan command-line tool
  • Test your App in Production with Behat
Estimated delivery fee Deliver to Sweden

Premium delivery 7 - 10 business days

€17.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Sep 14, 2016
Length: 402 pages
Edition : 1st
Language : English
ISBN-13 : 9781786462084
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Sweden

Premium delivery 7 - 10 business days

€17.95
(Includes tracking information)

Product Details

Publication date : Sep 14, 2016
Length: 402 pages
Edition : 1st
Language : English
ISBN-13 : 9781786462084
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 103.97
Laravel 5.x Cookbook
€41.99
Laravel 5 Essentials
€24.99
Full-Stack Vue.js 2 and Laravel 5
€36.99
Total 103.97 Stars icon
Banner background image

Table of Contents

11 Chapters
1. Setting Up and Installing Laravel Chevron down icon Chevron up icon
2. Using Composer Packages Chevron down icon Chevron up icon
3. Routing Chevron down icon Chevron up icon
4. Building Views and Adding Style Chevron down icon Chevron up icon
5. Working with Data Chevron down icon Chevron up icon
6. Adding Angular to Your App Chevron down icon Chevron up icon
7. Authentication, Security, and Subscriptions Chevron down icon Chevron up icon
8. Testing and Debugging Your Application Chevron down icon Chevron up icon
9. Adding Advanced Features to Your App Chevron down icon Chevron up icon
10. Deploying Your App Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
(6 Ratings)
5 star 0%
4 star 16.7%
3 star 0%
2 star 50%
1 star 33.3%
Filter icon Filter
Top Reviews

Filter reviews by




Noel Falcon Apr 18, 2018
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Good content
Amazon Verified review Amazon
KaylaKaze Aug 10, 2017
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
Word of advice: if you're writing a programming book, make your screenshots using a WHITE background on your IDE.
Amazon Verified review Amazon
MJW Oct 11, 2016
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
I'd be able to give it more stars if I could read the code examples. Unfortunately they have been take from screenshots of a code editor with a dark profile, so some code is indistinguishable from the background.The content may be great, but in terms of print and presentation, is not as good as the O'Reilly 'Cookbook' series.
Amazon Verified review Amazon
RK Oct 03, 2017
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
The code printed is very small for a number of snippets with white text merged into black background.. Whose idea black ?..REALLY not readable. .
Amazon Verified review Amazon
Amazon Customer Aug 24, 2021
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
I guess it was my fault really. I was looking for a good book for beginners but made a wrong purchase. The author is a programmer and not a teacher . Most of the content made assumptions that you were an advanced user of Laravel. The only concession wa the first chapter where you were introduced to the basic setup., and even for half of that chapter the reader is sent away somewhere or the other to get how-to information. I could have saved my money and downloaded free tutorials instead...which I eventually did . From the second chapter to the end the author was completely immersed in displaying his brilliance at programming and on his brilliant project he is working on in this Cookbook. It is a distressing book . I'd possibly eventually use it as a door stop. It is that heavy !
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela