Skip to content

Instantly share code, notes, and snippets.

@alnutile
alnutile / AboutTheBook.md
Created October 5, 2024 12:41
🚀 PHP and LLMs - the practicaal guide

About the Book

This book is a practical guide for PHP developers navigating the rapidly evolving landscape of Large Language Models (LLMs). Moving beyond the hype, it delves into real-world applications and solutions, providing step-by-step instructions on how to integrate LLMs into your existing projects.

From mastering prompts to building reusable tools and working with various LLMs, this book equips you with the skills needed to leverage the power of Ai in everyday development tasks.

Whether you’re looking to automate complex workflows, enhance content verification, or simply stay ahead in a changing industry, this book offers the insights and hands-on examples to get you there. This isn’t just another “Hello World” guide—it’s a deep dive into the future of PHP development, focusing on real solutions that drive real results.

Sample book here https://bit.ly/php_llms_sample

@alnutile
alnutile / session
Created November 25, 2023 19:29
session inertia
request()->session()->flash('flash.banner', 'Message sent, Thank you!');
<?php
namespace App\Services;
use Spatie\Tags\Tag;
use Ramsey\Uuid\Uuid;
use App\Models\Recall;
use App\Tagging\Subscribables;
use Illuminate\Database\Eloquent\Model;
use Google\Cloud\Firestore\FirestoreClient;
@alnutile
alnutile / coverage-checker.php
Created January 1, 2019 11:50
Code Coverage Checker
<?php
// coverage-checker.php
//https://ocramius.github.io/blog/automated-code-coverage-check-for-github-pull-requests-with-travis/
$inputFile = $argv[1];
$percentage = min(100, max(0, (int) $argv[2]));
if (!file_exists($inputFile)) {
throw new InvalidArgumentException('Invalid input file provided');
}
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
<?php
namespace Alnutile\Example;
class SkeletonClassTest extends TestCase
{
/**
* Test that true does in fact equal true
*/
public function testTrueIsTrue()
<?php
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
load_dotenv();
<?php
define('COMMAND_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Composer Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
@alnutile
alnutile / command.php
Last active June 17, 2017 00:33
Code for Medium post on CLI Skel
#!/usr/bin/env php
<?php
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\Process;
require __DIR__.'/bootstrap/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
---
- name: Create Oauth Keys
become: yes
become_user: catuser
command: php /home/{{ user }}/app/artisan passport:keys --quiet
ignore_errors: true
- name: Install for s3 module
pip:
name: boto