Laravel Code Tips

Related tags

Laravel laravel
Overview

Laravel Code Tips

This project is a simple Laravel application that uses:

  • Ryan Chandler's Orbit package for storing data in markdown files,
  • custom command for generating a static version of the website (this will later be extracted to a separate and more robust package),
  • Flipp for beautiful OpenGraph & Twitter Card previews,
  • Lars Klopstra's amazing design skills. Thanks a ton for the design ❤️

The live version can be found on laravel-code.tips or if you like emojis, that's 💻 🔥 ⚡️ 💡 .y.at.

Definitely feel free to submit content; it can be a great way to promote your work (not that you can't submit others' tips, we accept all that are good!).

Right now all tips should be on Twitter, but later we'll make it easier to add them standalone as well. That said, it's best to share your work on your Twitter profile before adding it here, since we link back to your Twitter post & profile, which will help you grow an audience.

Submitting tips

Open a PR adding a new file to content/tips. The file name should be a unique slug of the tip. The content should look like this:

---
title: 'Use strict comparison'
tweet_id: '1272826452652810240'
thread_slug: laravel-clean-code-tactics
author_username: samuelstancl
images:
    - 'https://pbs.twimg.com/media/Ean722QXgAENwmW.jpg'
created_at: 2021-04-06T16:07:36+00:00
slug: use-strict-comparison
---

ALWAYS use strict comparison (=== and !==). If needed, cast things go the correct type before comparing. Better than weird == results

Also consider enabling strict types in your code. This will prevent passing variables of wrong data types to functions

The slug matches the file name, the author_username is the Twitter handle of the tip author, tweet_id is the id of the tweet with the tip, and images is an array of images that should be shown between the heading and the content.'

Make sure you also create a record in content/users for your Twitter handle if your Author is not created yet. The tip's author_username needs to reference an Author model.

Helper command

You can also use the php artisan tweet:add command to add content, just make sure that the tweet's "dependencies" (author and possibly thread) are in place.

Local setup

If you'd like to seed the database with content, create a new Twitter application and set the TWITTER_TOKEN variable in .env to the Bearer token of the app. That said, you likely won't need this because all the default data is available in this repository already. So you only need to do this if you want to add a lot of tweets in bulk.

Otherwise, the project doesn't require any database, so you can just git clone it and open it in your browser, e.g. using Valet or artisan serve.

To generate the static HTML run composer generate and to preview it run composer serve.

You might also like...
Source code behind the Laracasts Larabit: Using MySQL JSON Columns with Laravel

Using MySQL JSON Columns with Laravel This is the source code behind the Laracasts Larabit: Using MySQL JSON Columns with Laravel, and features all of

In Laravel, we commonly face the problem of adding repetitive filtering code, this package will address this problem.

Filterable In Laravel, we commonly face the problem of adding repetitive filtering code, sorting and search as well this package will address this pro

Generate robust laravel athorization without writing a single line of code.

Implement robust laravel authorization logic without writing a single line of code This package helps you to quickly create strong policy authorizatio

Boilerplate code for protecting a form with proof of work. Uses javascript in the browser to generate the hashcash and PHP on the server to generate the puzzle and validate the proof of work.

Boilerplate code for protecting a form with proof of work. Uses javascript in the browser to generate the hashcash and PHP on the server to generate the puzzle and validate the proof of work.

This package provides convenient methods for making token code, sending and verifying mobile phone verification requests.
This package provides convenient methods for making token code, sending and verifying mobile phone verification requests.

Laravel Mobile Verification Introduction Many web applications require users to verify their mobile phone numbers before using the application. Rather

Blacksmith is a code generation tool which automates the creation of common files that you'd typically create for each entity in your application.
Blacksmith is a code generation tool which automates the creation of common files that you'd typically create for each entity in your application.

Blacksmith is a code generation tool which automates the creation of common files that you'd typically create for each entity in your application.

Source code behind the Laracasts Larabit: Creating and Using Custom Blade Directives

This is the source code behind the Laracasts Larabit: Creating and Using Custom Blade Directives, and features all of the files and code available in that video.

A simple package that helps PHP developers to generate the QR code signature as per Zakat authority (ZATCA) requirements of Saudi Arabia.

A PHP package that implements the e-invoice QR code signature requirements as designed by the Zakat authority of Saudi Arabia. How to install? compose

Projeto Trainee da CODE Jr. do qual fui Scrum Master.

Trainee2021.2 MyCão Pet Shop Projeto Trainee, Code Jr, Grupo 2, 2021.2 Desenvolvedores: Gabriel Duque Igor Ernandes Isabelly Cristine João Pedro Banha

Comments
  • Fix Alpine x-cloak not working for banner

    Fix Alpine x-cloak not working for banner

    The marketing banner flashes at first if a banner is hidden. This is due to the Alpine x-cloak. This PR fixed x-cloak and properly apply x-cloak on the banner.

    opened by abrardev99 2
  • Week 43

    Week 43

    The '->' in 'Use ->not to reverse an assertion in @pestphp' converted to '->', change it to -> in title, then to 'arrow' in slug and file name

    opened by lukinovec 2
Owner
ARCHTECH
Meticulously architected web applications.
ARCHTECH
🔌 Convert Bootstrap CSS code to Tailwind CSS code

Tailwindo This tool can convert Your CSS framework (currently Bootstrap) classes in HTML/PHP (any of your choice) files to equivalent Tailwind CSS cla

Awssat 938 Dec 24, 2022
laravel-vat is a package that contains the Laravel related wiring code for ibericode/vat

laravel-vat is a package that contains the Laravel related wiring code for ibericode/vat, helping you deal with VAT legislation for businesses based in the EU.

Danny van Kooten 117 Dec 5, 2022
Automatic multi-tenancy for Laravel. No code changes needed.

Tenancy for Laravel — stancl/tenancy Automatic multi-tenancy for your Laravel app. You won't have to change a thing in your application's code. ✔️ No

Samuel Štancl 2.7k Jan 3, 2023
A collection of extensions for Laravel development in Visual Studio Code

Laravel Extension Pack for Visual Studio Code Includes the basic extensions to get started with Laravel development in Visual Studio Code. Laravel Ext

Winnie Lin 24 Dec 25, 2022
A Laravel Code Generator based on your Models using Blade Template Engine

Laravel Code Generator is a PHP Laravel Package that uses Blade template engine to generate code for you. The difference between other code generators

Victor Yoalli 59 Dec 5, 2022
Laracast's awesome larabook tutorial - refreshed with Laravel 5.0 code

Larabook Updated - Laravel 5.0 A light version of Facebook, called Larabook. Updated using new techniques and features of Laravel 5.0 Fixes I tried my

Mike Wu 6 Dec 6, 2020
Laravel 4.* and 5.* service providers to handle PHP errors, dump variables, execute PHP code remotely in Google Chrome

Laravel 4.* service provider for PHP Console See https://github.com/barbushin/php-console-laravel/releases/tag/1.2.1 Use "php-console/laravel-service-

Sergey 73 Jun 1, 2022
A code generation tool for Laravel developers.

Blueprint is an open-source tool for rapidly generating multiple Laravel components from a single, human readable definition. Watch a quick demo of Bl

Laravel Shift 2.4k Jan 5, 2023
Source code behind the Laracasts Larabit: My Favorite Laravel Collections Methods

My Favorite Laravel Collections Methods This is the source code behind the Laracasts Larabit: My Favorite Laravel Collections Methods, and features al

Andrew Schmelyun 2 Dec 2, 2021
Source Code for 'Domain-Driven Laravel' by Jesse Griffin

Apress Source Code This repository accompanies Domain-Driven Laravel by Jesse Griffin (Apress, 2020). Download the files as a zip using the green butt

Apress 63 Dec 17, 2022