Skip to content

Instantly share code, notes, and snippets.

@dsebastien
Created August 29, 2024 09:00
Show Gist options
  • Save dsebastien/b32f96461391febeaf0239cfad2eef80 to your computer and use it in GitHub Desktop.
Save dsebastien/b32f96461391febeaf0239cfad2eef80 to your computer and use it in GitHub Desktop.
Example daily note

...

2024-08-29 - Thursday

...

Plan for today

Notes of the day

Done today

  • Decided to explore Laravel's ecosystem
  • Joined Obsidian insiders (Catalyst program) and started using v1.7.x
  • Love the startup speed improvements with Obsidian 1.7.x
  • ![[2024-08-29 - Obsidian 1.7 startup speed improvements.png]]

Discovered today

  • Composer
  • How to install PHP on Ubuntu
    • sudo add-apt-repository ppa:ondrej/php
    • sudo apt update
    • sudo apt upgrade
    • sudo apt install unzip php8.3 php8.3-cli php8.3-{bz2,curl,mbstring,intl}
    • Server API packages
      • sudo apt install php8.3-fpm
      • sudo a2enconf php8.3-fpm
      • sudo service apache2 restart
      • sudo service nginx restart
      • If upgrading from a previous version
        • sudo a2disconf php8.2-fpm
        • sudo apt purge php8.2*
    • List PHP packages installed on the system and save into a packages.txt file
      • dpkg -l | grep php | tee packages.txt
    • Add ondred/php PPA software repository (kept up to date)
      • sudo add-apt-repository ppa:ondrej/php
      • sudo apt update
  • How to install Composer on Ubuntu
    • curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
    • HASH=curl -sS https://composer.github.io/installer.sig
    • php -r "if (hash_file('SHA384', '/tmp/composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
    • sudo php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
    • composer --version
  • Laravel
    • Full-stack PHP framework
    • composer global require laravel/installer
    • Commands
      • php artisan route:list: List API routes
  • How to create a Laravel project
    • First, make sure php-xml is installed. laravel/pint requires it: sudo apt install php-xml
    • Second, install a sqlite driver (used by default in Laravel projects): sudo apt install php8.3-sqlite3
    • Third, install a pgsql driver (because why not): sudo apt install php-pgsql
    • composer create-project laravel/laravel example-app
  • How to run a Laravel application
    • Go to the root project folder
    • php artisan serve
  • Nginx
    • Simple but powerful Web server
  • How to install Nginx on Ubuntu
    • sudo add-apt-repository ppa:ondrej/nginx
    • sudo apt update
    • sudo apt install nginx
  • Laravel Herd
    • PHP development environment
    • Installs composer, laravel, expose, node, npm, nvm, and even PostgreSQL and Redis DBs (paid feature)
    • Does not support Linux
    • https://herd.laravel.com/
  • Valet
    • PHP development environment using NGINX
    • Supports Laravel, Zend, ...
    • Commands
      • valet park: add directories to the valet path so that each folder can be accessed using foldername.test
      • valet forget: remove a directory from the valet path (undoes what valet park does)
      • valet link: make folders individually accessible with foldername.test
      • valet unlink: reverse operation of valet link
      • valet use php@x.y: switch to another version of PHP
      • valet secure laravel: serve using TLS
      • valet unsecure laravel
      • valet status
    • Configuration
      • Possible to create a .valetrc file at the root of the project
        • php=php@x.y: Add that to the .valetrc file to tell Valet to use that version of PHP
    • References
  • How to install Valet on Ubuntu
    • sudo apt-get install network-manager libnss3-tools jq xsel dnsmasq inotify-tools
    • composer global require cpriego/valet-linux
    • valet install
    • Bash: echo "export PATH=$PATH:$HOME/.config/composer/vendor/bin" >> ~/.bashrc
    • ZSH: echo "export PATH=$PATH:$HOME/.config/composer/vendor/bin" >> ~/.zshrc
    • Activate Nginx: sudo systemctl start nginx
    • To reset the installation: composer global require cpriego/valet-linux
    • Reference: https://dev.to/dhimaskirana/install-laravel-valet-on-linux-ubuntu-1gmf
  • DBngin
    • All-in-one database management tool that includes MySQL, PostgreSQL and Redis
    • MacOS application
    • Does not support Linux: TablePlus/DBngin#5
    • Once installed, connect to the database at 127.0.0.1 using root as username and an empty string for the password
    • References
  • Laravel Sail
    • CLI for building Laravel apps using Docker and docker-compose
    • Great starting point for building a Laravel application using PHP, MySQL, PostgreSQL, Redis
    • Useful during development, but not required for production
    • Commands
      • Start Sail as a daemon: ./vendor/bin/sail up
      • Run DB migrations: ./vendor/bin/sail artisan migrate
    • References
  • How to install Laravel Sail
  • How to add Vue.js support to IntelliJ Idea
    • Plugins to install
      • Vue.js
  • How to add Laravel support to IntelliJ Idea
  • TypeScript support for Inertia
  • Ploi
    • Hosting and deployment platform
    • Optimized for Laraval
    • References
  • Explore docker-compose watch: https://docs.docker.com/compose/file-watch/

Interesting links

  • PKM / Thinking / Learning

  • Bootstrapping

  • Tech

  • AI

  • Cool

  • Books

Gratitude

  • Started exploring PHP again, now with Laravel. Fun stuff!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment