Setting up CircleCI Continuous Integration with Laravel – Then deploy Forge or Fortrabbit

Including Continuous Integration is great, but there are many providers to choose from. CircleCI has a pretty decent free plan, but using it for your Laravel app might be a bit confusing.

Instructions for deploying Laravel 5.5 with Circle CI:

This site has a nice boilerplate script:

https://medium.com/@wesmahler/circleci-2-0-configuration-for-laravel-5-5-with-laravel-dusk-ab1cc9b9d4a7

But if you found a better script, let us know in the comments.

Make sure you have specified the testing environment variables in your .env.testing and phpunit.xml if you are using PHPUnit.

Deploying on Laravel Forge via CI

After that call this forge-deploy.sh script in your final step in config.yml:

  - run:
     name: Run deploy script
     command: sudo chmod +x ./deploy.sh; sudo ./deploy.sh

Then create a deploy.sh script in your app and include the Laravel Forge / Envoyer deployment trigger URL (can be found in your app’s dashboard in Laravel Forge / Envoyer):

#!/bin/bash
# Trigger deployment
# Replace the url below with your envoyer/forge url
# APPLICATION1
curl -s 'https://forge.laravel.com/servers/123456...';

# APPLICATION2 - if you have multiple applications that needs to be deployed and triggered
curl -s 'https://forge.laravel.com/servers/12345678...';

echo 'Deployment triggered!'

After this, you can push to Github or Bitbucket and see if the build succeeds and deploys to Laravel Forge / Envoyer. Make sure you disable auto-deploy, as you only would like to deploy to Laravel Forge / Envoyer after a successful CI build.

Deploy on Fortrabbit with CircleCI

Rather want to deploy on Fortrabbit instead of Laravel Forge after a successful CircleCI build?

Read more about using CI with Fortrabbit here.

To setup the deployment to Fortrabbit from CircleCI follow this procedure:

  1. Run this script on a terminal client: ssh-keygen -m PEM -t rsa -C “your_email@example.com”
  2. Copy the private key to CircleCI
  3. Go to the project -> SSH Keys Enter hostname: deploy.XYZ.frbit.com (replace XYX with your Fortrabbit server location)
  4. Add the public key in the Fortrabbit Dashboard’s public SSH key manager
  5. Add the fingerprint that you see in the CircleCI dashboard to the config.yml file:
version: 2
jobs:
  deploy-job:
    steps:
      - add_ssh_keys:
          fingerprints:
            - "SO:ME:FIN:G:ER:PR:IN:T"

Try to push the updated files to Github or Bitbucket.

See whether this build succeeds. If not, fix the issues until it works.

Add this code to the circleci/config.yml script after the testing steps:

      - run:
         name: Add FRBIT remote
         command: git remote add frbit YOURFRBITGITURL

      - run:
         name: Add FRBIT remote fingerprint to known hosts
         command: ssh-keyscan deploy.XYZ.frbit.com >> ~/.ssh/known_hosts

      - run:
         name: Deploy to FRBIT
         command: git push frbit

Don’t forget to replace the variables YOURFRBITGITURL and XYZ.

Using these scripts and instructions is on your own risk of course.

Got any suggestions for a better workflow? Let us know!

Best Microsoft Edge extensions 2020 – Must-have browser add ons

Microsoft Edge has been growing rapidly. It is fast and simple, and it comes with many useful features like PDF and Slash. Microsoft Edge also offers a few extensions. The amount of extensions are growing and some Edge extensions are really nice!

Extensions can be described as small software programs, or apps, that integrate with Microsoft Edge. The extensions can help to make internet a safer place, and to make surfing easier and more effective in general. Extensions can be downloaded and installed from the Microsoft Store. Each extension is different in terms of function and utility. By adding extensions, you can customize your surfing experience and you can extend the features of the Microsoft Edge browser.

What are the best extensions to use with Microsoft Edge? We will discuss some popular options in detail.

The best Microsoft Edge extensions

TreeClicks

In case you are concerned about the environment you are living in (as you should!), you can opt for a ‘green’ extension. TreeClicks is an extension that plants trees for people who shop on many big websites such as Amazon, Asos, Ebay, Ikea, Adidas, Airbnb and Booking.com. When using the extension, the prices on the websites remain the same. So why not shopping and helping the environment at the same time?

We all know that shopping is not very nature-friendly: the best decision would be to cut down general consumption. But we also know that it’s impossible to keep people from shopping online. So by using this extension, you contribute to planting trees while you are buying things on the web. Just think about it: E-commerce is a huge economy, and if all of us would use the TreeClicks extension, extremely large amounts of forests could be planted!

For every order that you make online, TreeClicks will plant one tree. How does that work? When TreeClicks brings you in as a customer to its partnered shops, they received a fee, and with the biggest part of the money the company plants trees. In this way, online shoppers get the feeling that they are giving something back to the environment.

The company started to plant trees in India, and now they are looking for opportunities to plant trees in other parts of the world where deforestation is a big problem, like Indonesia and Brazil.

With TreeClicks you can keep shopping online while helping the environment and without extra costs. If everyone would start using TreeClicks, perhaps we will be living on a safer and better planet one day. Let’s all contribute to a happy world!

Install TreeClicks extension for Microsoft Edge >>

TreeClicks for Microsoft Edge Extension / Add On

Lastpass

This extension can be used to store all your passwords by creating an auto-pilot for them. After downloading and installing this extension, the Lastpass button will appear in your browser toolbar. You will use this button to log in to Lastpass. The next step is creating your account. You will need to come up with a very powerful password. Get inspired by, for example, some famous quotes or the lyrics of your favourite song. Lastpass allows you to add websites, and the extension will then save these websites as you log in. This means that passwords (and usernames) will automatically be filled as you browse your favourite websites.

Lastpass also automatically fills your profile with your details (personal details, payment information) when you are ordering something online. Besides, it saves information of other things including memberships and insurance cards.

With Lastpass you will definitely safe time and type less! Using Lastpass means that you only need to remember one password, and that’s the one from Lastpass. The program creates strong passwords thanks to the integrated password generator. The powerful password that it creates, will protect you against hackers. Information is kept safe any time.

Furthermore, with this extension you have the possibility to share your passwords with others in a safe and fast way. Last but not least: you can allow other people that you trust to access your account for urgent matters.

There is a free version of this extension, but if you would upgrade to premium, you will pay a fee starting from three dollars per month.

Install Lastpass for Microsoft Edge >>

Microsoft Translator

This extension translates content of foreign websites automatically in a fast and easy way. Microsoft Translator is one of the best extensions for this purpose. Not every website is written in the language that you understand, and you may need the information from that website. The extension will translate the complete page in your chosen language. As a student, researcher, or article writer this is extremely helpful. If you don’t want or need a translation of the whole page, you can also select a part of the information that you would like to have translated.

With Translator for Microsoft Edge you can translate web pages for more than 60 languages. How it works? Click on the Microsoft Translator icon in the toolbar while you are visiting a website that is not written in your preferred language. By clicking on the icon, the web page will instantly translate to your chosen language.

Download Translator add-on for Microsoft Edge >>

AdBlock

In case you are looking for an advertisement filter, AdBlock may be the best option. With AdBlock you can finally surf the web without annoying advertisements. AdBlock can be used for web pages where pop-up ads appear frequently. On the AdBlock icon in your toolbar it will show you the number of pop-up ads that the extension has blocked. By using AdBlock, you can have a better and faster web browsing experience.

AdBlock offers the possibility to use the extension exactly the way you want to. For example, you can indicate which ads you want to allow and which ones you want to block. You can set up these functions in the options page of the extension. Besides, you even have the ability to pause and manually block an ad.

With the AdBlock extension you can apply filters on (part of) a website. There are several types of filters, including deleting warnings about using ad blockers.

Thanks to AdBlock you will not have to deal any more with pop-ups, flashing banners and ads that you don’t want to see.

Adblock is completely free of costs.

Install AdBlock add on for Microsoft Edge >>

Grammarly

If you are looking for an excellent proofreading extension, you can opt for Grammarly. With this extension, spelling mistakes and embarrassing emails are a thing of the past. Grammarly makes sure that it detects your spelling mistakes as well as incorrect use of grammar. It also gives you suggestions to correct the type errors that you made.

It’s an extension that is useful for everyone, nowadays we write almost everything online. Whether you are writing a blog for your website, typing an email to your boss or chatting with a friend: Grammarly works in any situation. It can save you from some awkward moments!

The basic version of this extension is free, however there is also a paid plan which offers advanced skills to check grammar and spelling mistakes. The free version is for most people enough, because it catches the worst mistakes.

Grammarly does not just correct grammar and spelling mistakes, it also helps you find the perfect style and tone for writing your emails or texts. This way you can make sure that the reader will react the way you expect!

Install Grammarly extension for Edge >>

Office browser extension

When you install the Office extension, an icon will appear in your toolbar that allows access to all your Microsoft Office files that are stored on your computer and in OneDrive. This means that you can edit all your Word, OneNote, Excel, and PowerPoint files directly in your browser. It also means that you don’t need to open the apps on your desktop. This way you will consume less memory from your device. You can manage your personal and business accounts with this extension.

Also, you can get a list of the most recent documents that you accessed. It will help you to find the right documents faster. The extension even gives you the possibility to drag and drop documents to open them in your browser. The extension allows you to use Office wherever you are!

Just keep in mind that this extension is not a free version for Microsoft Office. If you want to download the extension, you will not need to install Office on the device that you’re using it on. However, you need a valid Microsoft Office license that is associated to your Microsoft account.

Download Office for Edge >>

Honey

Honey is a popular extension, especially for people who often shop online. With this extension you are able to save a lot of money while you are shopping on the web, because it detects the best coupon codes for more than 10.000 online shops. You will save tons of money when you are buying products on for example Amazon, or when you are booking a room on Airbnb. Even when ordering your pizza on Pizza Hut, or when buying your next favourite trainers on Nike you can be sure to pay the lowest prices!

From the moment you install the extension, a small ‘h’ will appear on your toolbar when you are shopping on your favourite websites. A window will pop up automatically, and you just need to click on ‘Apply coupons’ and Honey will make sure to compare every available coupon. Then, it will apply the biggest discounts to your cart.

The best thing about the extension is that you don’t need to change anything. Just install the extension and shop like you always do!

Download Honey Add On for Edge >>

PrintFriendly and PDF

When you often want to print articles on the web, but you don’t know the best way to do it, this may be the perfect extension. The PrintFriendly and PDF extension will remove ads and other materials that you don’t need when printing the articles. You want a clear printout of the page, without useless information. But the extension offers more than this. You can even remove images that you don’t need, or part of the content. Also, you can change the font size for the text. This extension is developed for a comfortable read experience!

So how exactly does it work? Visit the page you want to print and click on the green PrintFriendly icon in your toolbar. A dialog window will open, from where you will be able to make changes to the page. Remember that you can always undo any changes that you made. You simply need to click on ‘menu’ and select the ‘undo’ option.

When you are done modifying, you can save the page as a PDF or print it. When you save the file, it still includes clickable links. You can also share the page with friends.

The extension is very easy to use. You can install it at home and at work, so you can print a page whenever you need to!

Download PrintFriendly and PDF extension

Summary of best Microsoft Edge Browser Extensions

So in our opinion, the best Microsoft Edge Extensions are:

  1. TreeClicks
  2. Lastpass
  3. Translator for Edge
  4. AdBlock
  5. Grammarly
  6. Office for Microsoft Edge
  7. Honey for Edge
  8. PrintFriendly and PDF extension

Conclusion about best Edge Extensions

These are some of the most popular and best extensions so far. With these extensions you may translate webpages, block annoying ads, type flawless texts and emails, and buy products online using the best coupons. Besides, with the unique extension TreeClicks you can even contribute to a better world while you are doing your shopping online. We believe everyone should install the TreeClicks extension, the world of today needs some extra support! The Microsoft store keeps on growing, and more apps will be available. Installing extensions is easy and fast, and it will improve the features of Microsoft Edge. Make sure to keep yourself informed for further updates in the store!

Did you know that a lot of the Edge Extensions are also available for Chrome?

Laravel Add List-Unsubscribe Header to Mail (e.g. Mailgun & Hotmail)

When using e.g. Mailgun for Laravel Mail, sometimes it could happen that mails end up in spamfolders. One of the reasons for this is that default a List-Unsubscribe header is not set. That is a link that you send to your unsubscribe mail.

Add this code in you mail closure:

$message->getSwiftMessage()
                    ->getHeaders()
                    ->addTextHeader('List-Unsubscribe', '<' . action('NewsletterController@delete', 'YOURUSERIDORTOKEN') . '>');

So then it becomes like:

\Mail::send(['emails.newsletter-activate.html', 'emails.newsletter-activate.text'], $toMailView, function ($message) use ($email, $subject) {
            $message->subject($subject);
            $message->to($email);
            $message->getSwiftMessage()
                    ->getHeaders()
                    ->addTextHeader('List-Unsubscribe', '<' . action('NewsletterController@delete', 'YOURUSERIDORTOKEN') . '>');
        });

This seems to work in Hotmail. In our cases it removed the case where Hotmail moved our Mailgun e-mails to the SPAM-box.

Are mails completely blocked by your ISP? Ask MailGun for a new IP

We also had a case where Mailgun assigned us an IP that was blocked by Hotmail. Send a support query to Mailgun and ask for a new IP-address. With above tips Mailgun delivered our e-mails correctly in the mailbox.

Validating meta title and meta description with jQuery

Would you like to auto-display validation hints when a meta_title field is longer than 55 chars and a meta_description field is longer than 155 chars?

Then you can use this package: jQuery Meta Title and Description Validation.

Setup
1. Have at least one input field named meta_title or meta_description

E.g.

2. Initialize by including jquery-meta-validation.js


Laravel 5 Admin Middleware (is_admin user check)

Would you like to have middleware that makes sure that only users with an is_admin = 1 status will be able to see the admin section? Then you can use the following code:

app/Http/Middleware/AdminMiddleware.php

is_admin == 1)
        {
            return $next($request);
        }

        return redirect()->guest('/');
    }
}

Make sure you’ll register the middleware as a route in app/Http/Kernel.php

protected $routeMiddleware = [
        'auth' => \App\Http\Middleware\Authenticate::class,
        'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
        'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
        'admin' => \App\Http\Middleware\AdminMiddleware::class
];

Finally assign this middleware in the routes.php next to the auth middleware, since the admin middleware is an extension to the auth middleware.

App/Http/routes.php

Route::group(['prefix' => 'administration', 'middleware' => ['auth', 'admin']], function()
{
	Route::get('/', 'Admin\HomeController@index');
}

If you’ve suggestions to make this coding more efficient, you’re always welcome to drop a comment below.

SSH import sql database with host syntax (if not localhost)

How to import a .sql.gz file when the host is not localhost? Use this syntax:

$ mysql -h db365838511.db.1and1.com -u dbun1234 -p db365838511 < 1and1help.com-Joomla-Apr.05.2010.sql

Explanation:

  • mysql: This is the MySQL command to access your databases
  • -h db365838511.db.1and1.com: This is the Host Name where your database is located (available from the 1&1 Control Panel).
  • -u dbun1234: This is the User Name for your database (available from the 1&1 Control Panel).
  • -p: This is to prompt for a password. Do not type the password now. You will be asked for the password after you hit ENTER.
  • db111111111: This is the database name.
  • < : This is to specify a database file should be imported to the database.
  • 1and1help.com-Joomla-Apr.05.2010.sql: This is the filename you will enter to specify which of the files you wish to import.

Source: 1and1

Magento Show Poll Results

Add this code in order to show the poll results in de poll block (using this article):

In addition for the result add in poll.phtml:

if ($poll->isVoted($poll->getId()) == TRUE) {
//Template Block
echo $this->getLayout()->createBlock(‘core/template’)->setTemplate(‘poll/result.phtml’)->setAttribute(‘my_poll_id’, $poll->getId())->toHtml();
} else {

// add the rest of the poll script here

}

Further open results.phtml and add on top:

if(!isset($poll)) {
$poll = new Mage_Poll_Model_Poll();
$poll->load($this->my_poll_id);

$action = Mage::getUrl(‘poll/vote/add’, array(‘poll_id’ => $poll->getId()));

$poll_answers = Mage::getModel(‘poll/poll_answer’)
->getResourceCollection()
->addPollFilter($poll->getId())
->load()
->countPercent($poll);

}

This should do the trick!

Lesti::Fpc and Layered Navigation

Lesti::Fpc is a great free Full Page Cache plugin for Magento. Though, it could be that it doesn’t work with Layered Navigation.

Solution

1. Go to your site and layered navigation and hover with your mouse on a filter item. It shows the url parameters (like ?color=red&manufacturer=brand).

2. Those parameter you need to add in the admin > config > system > Lesti::FPC > URL params. There add all the possible parameters from above. Like:

price,
cat,
manufacturer,
no_cache,
color

 

Magento import multiple images in dataflow csv/xml

Sometimes it’s really annoying that Magento only supports one image per product. On the Magento Commerce forum a solution is found:

Now, what you need to do is open the file
app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php
and go to around line 773 and find

$addedFilesCorrespondence = $mediaGalleryBackendModel->addImagesWithDifferentMediaAttributes(
$product,
$arrayToMassAdd, Mage::getBaseDir('media') . DS . 'import',
false,
false
);

and paste the following code right after it
if (isset($importData['media_gallery']) && !empty($importData['media_gallery'])) {
$x = explode(',', $importData['media_gallery']);
foreach ($x as $file) {
$imagesToAdd[] = array('file' => trim($file));
}
$mediaGalleryBackendModel->addImagesWithDifferentMediaAttributes(
$product,
$imagesToAdd, Mage::getBaseDir('media') . DS . 'import',
false,
false
);
}

Source: http://www.magentocommerce.com/boards/viewthread/224928/P45/