polyfony-inc / polyfony

Polyfony is an intuitive, light and powerful PHP micro-framework
GNU General Public License v3.0
10 stars 1 forks source link

Allow for expirable signed URLs #342

Closed AnnoyingTechnology closed 9 months ago

AnnoyingTechnology commented 9 months ago
Router::get(
    '/unsubscribe/:id_account/', 
    'Shared/Subscriptions@unsubscribe', 
    'subscriptions'
)->sign()->expiresOn(time()+3600);
// or
)->sign()->ttl(3600);
// or
)->sign()->temporary(3600);

If the validity has expired, the framework should return 410 Gone with a localizable Exception "This link has expired on XX/XX/XXXX HH:ii"