REST API vs GraphQL: Quale Scegliere nel 2024?
Un confronto approfondito tra REST e GraphQL per aiutarti a scegliere la soluzione giusta per il tuo...
Guida completa alle Progressive Web App: cosa sono, come funzionano e perché rappresentano il futuro del web.
Autore
Giovanni D'Ippolito
Pubblicato
15 December 2025
Tempo di lettura
3 minuti
Le Web App sono applicazioni che funzionano nel browser ma offrono un'esperienza simile alle app native. Scopriamo perché stanno rivoluzionando il web.
Una Web App è un'applicazione accessibile via browser che offre funzionalità avanzate, interattività e può funzionare anche offline.
// Esempio SPA con Vue.js
const app = Vue.createApp({
data() {
return {
products: [],
loading: true
}
},
async mounted() {
this.products = await this.fetchProducts();
this.loading = false;
},
methods: {
async fetchProducts() {
const response = await fetch('/api/products');
return response.json();
},
async addToCart(productId) {
await fetch('/api/cart', {
method: 'POST',
body: JSON.stringify({ product_id: productId }),
headers: { 'Content-Type': 'application/json' }
});
this.updateCartCount();
}
}
});
// Service Worker per PWA
self.addEventListener('install', (event) => {
event.waitUntil(
caches.open('v1').then((cache) => {
return cache.addAll([
'/',
'/css/app.css',
'/js/app.js',
'/images/logo.png'
]);
})
);
});
self.addEventListener('fetch', (event) => {
event.respondWith(
caches.match(event.request).then((response) => {
// Ritorna dalla cache o dalla rete
return response || fetch(event.request);
})
);
});
<?php
// Laravel WebSocket con Pusher
// Broadcasting Event
class OrderStatusUpdated implements ShouldBroadcast
{
public function __construct(
public Order $order
) {}
public function broadcastOn()
{
return new PrivateChannel('orders.' . $this->order->user_id);
}
public function broadcastWith()
{
return [
'order_id' => $this->order->id,
'status' => $this->order->status,
'updated_at' => $this->order->updated_at
];
}
}
// Nel controller
OrderStatusUpdated::dispatch($order);
?>
// Frontend - ascolto eventi
Echo.private(`orders.${userId}`)
.listen('OrderStatusUpdated', (e) => {
// Aggiorna UI in tempo reale
updateOrderStatus(e.order_id, e.status);
showNotification(`Ordine ${e.order_id} aggiornato!`);
});
| Caratteristica | Web App | App Nativa |
|---|---|---|
| Sviluppo | Una codebase | iOS + Android separate |
| Distribuzione | URL diretto | App Store/Play Store |
| Costi | €10.000 - €50.000 | €30.000 - €150.000 |
| Aggiornamenti | Istantanei | Review store (giorni/settimane) |
| Performance | Buone (migliorano) | Eccellenti |
| Offline | Sì (con PWA) | Sì |
<?php
// Dashboard real-time Laravel + Livewire
class DashboardStats extends Component
{
public $salesTotal;
public $ordersCount;
public $visitors;
protected $listeners = ['refreshStats'];
public function mount()
{
$this->loadStats();
}
public function loadStats()
{
$this->salesTotal = Order::today()->sum('total');
$this->ordersCount = Order::today()->count();
$this->visitors = Analytics::visitors()->today();
}
public function refreshStats()
{
$this->loadStats();
}
}
?>
# Stack moderno per Web App
# Frontend
npm install vue@next
npm install @inertiajs/vue3
npm install @tailwindcss/forms
# Backend Laravel
composer require laravel/sanctum
composer require pusher/pusher-php-server
composer require spatie/laravel-permission
Un confronto approfondito tra REST e GraphQL per aiutarti a scegliere la soluzione giusta per il tuo...
Configura un ambiente di sviluppo Docker ottimizzato per progetti Laravel.
Le funzionalità JavaScript moderne che ogni sviluppatore PHP dovrebbe conoscere.
Iscriviti alla nostra newsletter per ricevere gli ultimi articoli e novità direttamente nella tua casella di posta.