Terminal: An Elegant Wrapper around the Symfony Process Component

Terminal is a neat PHP package by Titas Gailius that provides a “wrapper around Symfony’s Process component.” It has a fluent interface, which makes running terminal commands a breeze:

Terminal::in(storage_path('sites/123')) ->timeout(120) ->retries(3) ->run('wp cli update');

In the most simple form, a command might look like the following—which removes a lot of boilerplate and lower-level details of the wonderful Symfony Process component:

$response = Terminal::run('rm -rf vendor');

Here are some things you can do with the response from the run command:

$response->code() : int;
$response->ok() : bool;
$response->successful() : bool; $response->lines() : array;
$response->output() : string;
(string) $response: string; // Terminal captures exceptions that you can throw
$response->throw(); // You can access the symfony process
$response->process(); // All calls not found on the Response are passed to Symfony process
// \Symfony\Component\Process\Process::isRunning()
$response->isRunning();

Here are a few more neat examples from the readme:

// Passing data to the command
Terminal::with([ 'firstname' => 'John', 'lastname' => 'Doe',
])->run('echo Hello, {{ $firstname}} {{ $lastname }}'); // Retries and duration between each retry
Terminal::retries(3, 100)->run('rm -rf vendor'); // Environment variables
Terminal::withEnvironmentVariables([ 'APP_ENV' => 'testing',
])->run('rm -rf $DIRECTORY');

You can learn more about this package, get full installation instructions, and view the source code on GitHub at TitasGailius/terminal.

Filed in: News / packages

Related posts

Tagged : /

Bodhi Linux 5.1.0 Released based on Ubuntu 18.04.4 LTS

A new version of Bodhi Linux is available to download based on the recent Ubuntu 18.04.4 point release.

While Bodhi Linux isn’t a so-called headline distro it has gained a solid following over the years thanks to its combination of low system resource requirements and solid performance with the quirky Moksha desktop environment and popular lightweight desktop apps.

And truth be told I have a bit of a soft spot for it, too. I like distros that ‘do things differently’ and, amidst a a sea of pale Ubuntu spins sporting minor cosmetic changes, Bodhi Linux does just that.

Bodhi Linux Screenshot

Bodhi 5.1.0

Bodhi Linux 5.1.0 is the first major update to the distro in almost two years, and succeeds the Bodhi 5.0 release back in 2018.

The update, aside from being based on the recent Ubuntu 18.04.4 LTS release and HWE, makes some software substitutions. The ePad text editor is replaced with the lightweight Leafpad. Likewise, the Midori web browser is supplanted by Epiphany (aka GNOME Web).

To help promote the new release Bodhi devs have put together the following video ‘trailer’, which you can view below if your browser supports video embeds:

[embedded content]

Bodhi Linux runs well on low-end machines (though not exclusively; it’s perfectly usable for gaming rigs too). If you’re minded to give an old Celeron-powered netbook a new purpose then a Bodhi install wouldn’t be a bad way to go about it.

Fair warning though: the Moksha desktop environment, which is based on Enlightenment libraries, is not for everyone. The modular nature of Moksha means it works rather differently to vertically-integrated DEs like GNOME Shell and KDE Plasma.

But different isn’t necessarily bad.

You can learn more about the Bodhi Linux 5.1 release on the distro’s official blog. To download the very latest release as a 64-bit .iSO hit the button below, or grab the official torrent:

Download Bodhi Linux 5.1.0 (64-bit .iso)

If you have a 32-bit only machine you can download and use the Bodhi Linux 5.1 legacy release. This features Linux kernel 4.9 and no PAE extension:

Download Bodhi Linux 5.1.0 (32-bit .iso)

Download News

Related posts

Tagged : / / /

Laravel 7.3 Released

The Laravel team released v7.3.0 yesterday with the ability to use ^4.0 versions of ramsey/uuid. Since the release of Laravel 7.2, a few patch releases are available that we’ll briefly cover:

Ability to use Ramsey UUID V4

Laravel 7.3 adds the possibility to use ^4.0 of ramsey/uuid, but still supports v3.7 as well. The composer dependency is now ^3.7|^4.0.

Component Fixes

Laravel 7.2.2 fixes a few blade component issues. Notably, the make:component command now supports subdirectories:

php artisan make:component Navigation/Item # previously creates the following: # View/Components/Navigation/Item.php # views/components/item.blade.php # Now creates them as expected: # View/Components/Navigation/Item.php # views/components/navigation/item.blade.php

Fix Route Naming Issue

Laravel 7 introduced route caching speed improvements, but with that have been a few issues with apps in-the-wild. Laravel 7.2.1 fixed a route naming issue with cache; you should upgrade to the latest 7.x release to get the newest routing fixes.

It’s important to note that you should ensure the uniqueness of route names, as routes with duplicate names can “cause unexpected behavior in multiple areas of the framework.”

Release Notes

The remainder of the updates since v7.2.0 are changes and fixes, which are listed in full below. You can see the full list of new features and updates below and the whole diff between 7.2.0 and 7.3.0 on GitHub. The full release notes for Laravel 7.x are available in the latest v7 changelog:

v7.3.0

Added

  • Added possibility to use ^4.0 versions of ramsey/uuid (#32086)

Fixed

  • Corrected suggested dependencies (#32072, c01a70e)
  • Avoid deadlock in test when sharing process group (#32067)

v7.2.2

Fixed

  • Fixed empty data for blade components (#32032)
  • Fixed subdirectories when making components by make:component (#32030)
  • Fixed serialization of models when sending notifications (#32051)
  • Fixed route trailing slash in cached routes matcher (#32048)

Changed

  • Throw exception for non existing component alias (#32036)
  • Don’t overwrite published stub files by default in stub:publish command (#32038)

v7.2.1

Fixed

  • Enabling Windows absolute cache paths normalizing (#31985, adfcb59)
  • Fixed blade newlines (#32026)
  • Fixed exception rendering in debug mode (#32027)
  • Fixed route naming issue (#32028)

Filed in: News / Releases

Related posts

Tagged : /

Keep Track of Model Inventory with Laravel Stock

Laravel Stock is a package by Gijs Jorissen for keeping track of inventory counts on models:

Keep stock for Eloquent models. This package will track stock mutations for your models. You can increase, decrease, clear, and set stock. It’s also possible to check if a model is in stock (on a certain date/time).

For example, let’s say you have a Book model with which you need to keep track of stock:

use Appstract\Stock\HasStock; class Book extends Model
{ use HasStock;
}

When a customer places an order for a book, you can change the stock counts:

$book->increaseStock(10);
$book->decreaseStock(10); // Change stock positively or negatively with one method
$book->mutateStock(10);
$book->mutateStock(-10);

Next, in your UI you could check to see if a product is in stock:

$book->inStock();
// See if you have at least 10 of the same book in stock
$book->inStock(10);

Finally, you can clear stock out:

$book->clearStock(); // Clear stock and then set a new value
$book->clearStock(10);

You can learn more about this package, get full installation instructions, and view the source code on GitHub at appstract/laravel-stock.

Filed in: News / packages

Related posts

Tagged : /

How We Run Laracon Online

Ever wondered what all goes into running an online conference? Or want to see the behind scenes on how we do Laracon Online each year?

Ian Landsman has a new post on his site on how to run a successful online conference:

A few weeks ago we completed our fourth installment of Laracon Online. An annual fully online conference for the Laravel PHP framework and related technologies.

Each year Laracon Online has over 4,000 paid attendees from over 100 countries.

With the rise of COVID-19 and the cancellation of so many significant events it seemed like the right time to write up how we pull off Laracon Online and how you can do the same.

Read the full post for all the details and what all is involved.

***
Featured photo by Andreas Dress from Unsplash

Filed in: News

Related posts

Tagged :

Laravel Airlock Renamed to Sanctum

Last week the Laravel blog announced that Laravel Airlock needed to change “due to a trademark dispute regarding the name ‘Airlock.’”

The new name is Laravel Sanctum.

You may even be coming here after seeing an airlock package abandonment warning when installing v1.x versions:

Below you can find a few other details on updating your code if you depend on laravel/airlock.

TLDR

You need to find/replace anywhere in your code you find Airlock and airlock to Sanctum and sanctum, respectively.

Steps to Update

Everything feature-wise remains the same, but you’ll need to make a few changes to start using the new repo and drop the abandoned laravel/airlock package. The diff of the documentation page could be helpful to follow along if you need to update existing projects.

The rough steps to change from Airlock involve the following:

  1. Add the laravel/sanctum composer dependency
  2. Either publish the sanctum vendor config or move the existing config/airlock.php config
  3. Find/replace Airlock for Sanctum and airlock for sanctum
    • If you’re using the middleware for a SPA, change Airlock to Sanctum
    • Update any environment configuration for AIRLOCK_STATEFUL_DOMAINS to SANCTUM_STATEFUL_DOMAINS
  4. Remove config/airlock.php
  5. Remove laravel/airlock from the project’s composer dependencies

Note: be sure to remember to retain any customizations you’ve made to config/airlock.php

Here are the rough commands for all the steps:

# Step 1 - install Sanctum
composer install laravel/sanctum # Step 2 - Publish the sanctum vendor config
php artisan vendor:publish \ --provider="Laravel\Sanctum\SanctumServiceProvider" # Step 3
# Manually find/replace Airlock instances in your code # Step 4 - if you published config/sanctum.php
rm config/airlock.php # Step 5
composer remove laravel/airlock

Here’s the example from the documentation for importing the Sanctum middleware, so if you’ve done this already in your project change use Laravel\Airlock\... to reference use Laravel\Sanctum\... instead:

use Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful; 'api' => [ EnsureFrontendRequestsAreStateful::class, 'throttle:60,1', \Illuminate\Routing\Middleware\SubstituteBindings::class,
],

Learn More

To learn more about using Sanctum, check out the official documenation. The source code is on GitHub at laravel/sanctum.

Filed in: News

Related posts

Tagged :

Laracon US 2020 Cancelled

Today, the team behind Laracon US announced on Twitter they are canceling the event due to COVID-19:

We have postponed Laracon US 2020 and are refunding all orders. We have to refund each order individually so that may take a few days. We will be back soon with news on our next steps, including a possible online event.

Both Laracon EU and Laravel Live have canceled as well. As soon as we get information about these events we will be sure and pass them along.

Filed in: News

Related posts

Tagged :

Waveform Free is a Professional Digital Audio Workstation with Linux Support

If you like to make music on Linux then you’ve no doubt heard about Tracktion T7 DAW, considered one of the best free digital audio workstations around.

But that’s changing. A new, free replacement for Traction T7 DAW has been announced — and it looks mighty impressive!

First a bit of background. New versions of Tracktion for Windows, macOS and Linux are typically released as paid, closed source software.

But every few years the company behind the pro audio tool releases an older version entirely for free (as in beer), with no functional limitations at all.

The “catch” is that while it’s free to download it is not not open source software. And you don’t get access to email support (thankfully there’s a great community forum that stands in for that).

The most recent “free” version is Tracktion 7. This is an incredibly powerful music production platform that gives all the tools you need to record and produce music on Linux, complete with support for third-party virtual effects and instruments (VSTs).

Whether you want to create and edit podcasts, record, edit and mix band recordings, create electronic music using plugins, VSTs and other audio processing effects, or process audio for use in a video — this tool is up to the job.

But in a break with expectation the next free version of the software won’t be Tracktion T8 (or even Tracktion 10) as expected.

Instead, it’ll be a brand new version: Tracktion Waveform.

Tracktion Waveform Free

[embedded content]

In an unusual (but hey: not complaining) move Tracktion has decided to release a free version of their latest software, Waveform 11.

Waveform 11 Free is pitched as the free (as in beer) replacement for T7 DAW. Indeed, links to download Tracktion T7 now redirect to the Waveform landing page.

This switch means audio enthusiasts no longer need to wait for an ‘older’ release to be gifted as the current version (with improved UI, better performance, multi-monitor support, new samplers and tools, and even a VST sandbox – no more crashing the entire app when an instrument goes rogue) is available gratis.

“Waveform Free […] has more capabilities than most enthusiast producers will ever need. There are no restrictions whatsoever – unlimited track count, add popular plugins and enjoy the deeply capable feature set,” reads the official blurb.

But naturally there is a catch.

Tracktion Waveform Free Has Limitations

A raft of functionality is clipped in the free version — enough to clip the creative capabilities that might otherwise be available.

For instance, there’s no Track Editor; no Arranger Track; no quick actions; and no layout customisations permitted.

Mastering is less viable as the powerful Master Mix DSP is kept firmly behind the paid-only curtain, as are a bunch of other useful DSTs, samplers, and drum machines.

The upside is that you might not miss this functionality unless you’re tackling advanced tasks or a professional editor. There is an in-app option in Waveform Free to pay $69 to unlock the features should you really need them.

Download Tracktion Waveform Free for Linux

Overall this is an interesting new approach for what is a well regarded piece software. It’s especially nice that a Linux version of both free and pro builds will continue to be made available.

You can download Waveform Free for Windows, macOS and Linux directly from the Tracktion website:

Download page for Tracktion Waveform Free

Although free, to download Waveform Free you need a valid e-mail address and have to accept a privacy policy.

I also found that trying to download the app kept resulting in a server error. A workaround is create an account here, log in, then access the download page. Enter all your details and bam: access.

The Linux build is provided as a 64-bit .deb installer roughly 50MB in size.

While I don’t use digital audio workstation (DAW) software myself (thus I can’t offer too much insight into whether this switch will a bad thing per se) I have to say: a newer code base, with better OS support, improved UI and performance, PLUS a tonne of new tools and features …all for free… doesn’t sound too bad, does it?

Related posts

Tagged : / / / / /

pdfmatrix.com: fast and reliable HTML 2 PDF conversion SaaS (sponsor)

The online application pdfmatrix.com may be relatively young on the PDF toolkit scene, but it has already pulled FAR ahead of its competitors with a lot of happy clients making it their go-to for HTML/URLs to PDF conversion in the months after its initial release. In case you are wondering, yes – FAR is an acronym. One that stands for Fast, Affordable, Reliable. Having said that, let’s break down all the neat aspects that provide pdfmatrix.com with its competitive edge.

pdfmatrix.com is based on Laravel’s latest version, coupled with smooth and seamless UI and API. As for the app’s HTML/URL to PDF conversion superpowers, they are based on pre-launched Chrome browsers; this speeds up the HTML to PDF conversion process. The browsers are dedicated and isolated for each user and are scaled based on load / requests to unlimited instances. The browsers themselves are isolated and they are being used only by a single user at a time, no user data is saved or shared.

The application’s servers reside at the depths of the DigitalOcean, where speed, security, and scalability are ensured, as the PDF docs generated by users are stored at a secure cloud storage. But the cherry on top through which pdfmatrix.com finds its fine balance between affordability, performance, and efficiency is the tons of customization options that the application enables its users to perform while converting their HTML files or URLs.

What makes pdfmatrix.com unlike any of its competitors is that it allows users to convert an entire website into a single PDF page. What this means is that you can encompass the entirety of a given website’s contents, all within your single-paged PDF doc. Another nice feature to be highlighted is that pdfmatrix.com has the ability to scroll down to the bottom of the page you wish to convert, where it waits for all the resources to load and then scrolls up back again.

In effect, this way the entire webpage is being captured as the application waits for all the images and scripts to be loaded before arranging everything within a single PDF page. The app also allows for grey-scaling the converted HTML/URL through a CSS filter for those of you distracted by too much color, or taking a screenshot of the page for the sake of extra convenience. All this on top of some more standard customization options such as setting margins and content parameters.

This across-the-board customization that pdfmatrix.com offers is available with all of the service’s monthly subscription plans. The only thing that separates the free from the basic, and then the basic from the PRO plan, is the number of API requests included for one month. Still, if you haven’t squeezed your monthly plan to the absolute maximum, fear not. The number of API calls you have not used in any one month are automatically transferred to the following one, so you lose nothing. As for the files that you have created, they are securely stored for free for one month or until deleted by you.

Using pdfmatrix.com in combination with other web-based tools is made easy through its Zapier integration. So, to sum up, and keep it really short and sweet, pdfmatrix.com is a convenient to excellent choice for fellow developers, small to medium businesses and regular dudes, all of you who wish to save on precious time and costly toolkits and spend more on productivity.

See for yourself:
<https://pdfmatrix.com/>

Filed in: News

Related posts

Tagged :

Using Google Sheets with Eloquent

Eloquent Sheets is a package by Ed Grosvenor that lets you work with Google Sheets via Eloquent models:

This package provides an Eloquent model that sits on top of a Google Sheet. In order for it to work, there are two things your sheet needs to have. One is a heading row that holds the name of your columns. This defaults to row 1 (the top row) but it can be any row in the sheet. The other is a primary key column. Eloquent assumes that your primary key column is named id. If it’s not, set it in your model like you would normally.

Going through the readme will get you set up, and once you have a generated model class, it will look something like the following example:

use Grosv\EloquentSheets\SheetModel; class YourGoogleSheetsModel extends SheetModel
{ // The id of the spreadsheet protected $spreadsheetId = '1HxNqqLtc614UVLoTLEItfvcdcOm3URBEM2Zkr36Z1rE'; // The id of the sheet within the spreadsheet (gid=xxxxx on the URL) protected $sheetId = '0'; // The row containing the names of your columns (eg. id, name, email, phone) protected $headerRow = '1';
}

With the Google Sheet model, you can use basic eloquent features; however, the model can only use read and list methods at this time. Update and insert won’t work, but this package does provide a way to read sheet data via Eloquent. Insert and update functionality might be added in the future.

If you’d like to learn more about this package, check it out on GitHub at grosv/eloquent-sheets.

Filed in: News / packages

Related posts

Tagged : /